tsm_system_rows
TABLESAMPLE method which accepts number of rows as a limit
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
tsm_system_rows | 1.0 | FUNC | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4910 | tsm_system_rows | No | Yes | No | Yes | Yes | No | - |
| Related | random permuteseq tsm_system_time pg_crash pg_idkit pgx_ulid pg_uuidv7 pg_hashids |
|---|---|
| Depended By | documentdb |
Version
| PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|
| 1.0 | 1.0 | 1.0 | 1.0 | 1.0 |
Install
Note: This is a built-in contrib extension of PostgreSQL
CREATE EXTENSION tsm_system_rows;
Usage
Provides the SYSTEM_ROWS table sampling method that returns exactly the specified number of rows.
CREATE EXTENSION tsm_system_rows;
TABLESAMPLE Method
SYSTEM_ROWS(count int) – maximum number of rows to return.
Examples
-- Sample exactly 100 rows
SELECT * FROM my_table TABLESAMPLE SYSTEM_ROWS(100);
-- Quick peek at 10 rows from a large table
SELECT * FROM large_table TABLESAMPLE SYSTEM_ROWS(10);
Performs block-level sampling (may exhibit clustering effects with small samples). Returns all rows if the table has fewer rows than requested. Does not support REPEATABLE.
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.