Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Postgres/contrib/tsm_system_rows/sql/   (Postgres Database Version 18.4©)  Datei vom 11.4.2026 mit Größe 1 kB image not shown  

Quelle  tsm_system_rows.sql

  Sprache: SQL
 

CREATE EXTENSION tsm_system_rows;

CREATE TABLE test_tablesample (id int, name text);
INSERT INTO test_tablesample SELECT i, repeat(i::text, 1000)
  FROM generate_series(030) s(i);
ANALYZE test_tablesample;

SELECT count(*) FROM test_tablesample TABLESAMPLE system_rows (0);
SELECT count(*) FROM test_tablesample TABLESAMPLE system_rows (1);
SELECT count(*) FROM test_tablesample TABLESAMPLE system_rows (10);
SELECT count(*) FROM test_tablesample TABLESAMPLE system_rows (100);

-- bad parameters should get through planning, but not execution:
EXPLAIN (COSTS OFF)
SELECT id FROM test_tablesample TABLESAMPLE system_rows (-1);

SELECT id FROM test_tablesample TABLESAMPLE system_rows (-1);

-- fail, this method is not repeatable:
SELECT * FROM test_tablesample TABLESAMPLE system_rows (10) REPEATABLE (0);

-- but a join should be allowed:
EXPLAIN (COSTS OFF)
SELECT * FROM
  (VALUES (0),(10),(100)) v(nrows),
  LATERAL (SELECT count(*) FROM test_tablesample
           TABLESAMPLE system_rows (nrows)) ss;

SELECT * FROM
  (VALUES (0),(10),(100)) v(nrows),
  LATERAL (SELECT count(*) FROM test_tablesample
           TABLESAMPLE system_rows (nrows)) ss;

CREATE VIEW vv AS
  SELECT count(*) FROM test_tablesample TABLESAMPLE system_rows (20);

SELECT * FROM vv;

DROP EXTENSION tsm_system_rows;  -- fail, view depends on extension

Messung V0.5 in Prozent
C=83 H=96 G=89

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-08-08) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.