tsm_system_time
tsm_system_time
tsm_system_time : TABLESAMPLE method which accepts time in milliseconds as a limit
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4890 | tsm_system_time
|
tsm_system_time
|
1.0 |
FUNC
|
PostgreSQL
|
C
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-dt-
|
No
|
Yes
|
No
|
Yes
|
no
|
yes
|
| Relationships | |
|---|---|
| See Also | random
permuteseq
tsm_system_rows
pg_crash
pg_idkit
pgx_ulid
pg_uuidv7
pg_hashids
|
Packages
| PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|
1.0
|
1.0
|
1.0
|
1.0
|
1.0
|
This is a built-in contrib extension ship with the PostgreSQL kernel
Install
Create this extension with:
CREATE EXTENSION tsm_system_time;Usage
Provides the SYSTEM_TIME table sampling method that returns as many rows as can be read within a specified time limit.
CREATE EXTENSION tsm_system_time;TABLESAMPLE Method
SYSTEM_TIME(milliseconds float) – maximum time to spend reading the table.
Examples
-- Sample rows readable within 1 second
SELECT * FROM my_table TABLESAMPLE SYSTEM_TIME(1000);
-- Sample from a large table with a 500ms budget
SELECT count(*) FROM large_table TABLESAMPLE SYSTEM_TIME(500);Performs block-level sampling (not row-level). If the entire table can be read within the time limit, all rows are returned. Does not support REPEATABLE.
Last updated on