This function relies on the per backend caching using the in-built
storage manager layer to compute the approximate size
cheaply. The PG cache invalidation clears off the cached size for a
when DML happens into it. That size cache is thus able to get
the latest size in a matter of minutes. Also, due to the backend
caching, any long running session will only fetch latest data for new
or modified s and can use the cached data (which is calculated
afresh the first time around) effectively for older s. Thus it
is recommended to use a single connected backend session to
compute the approximate sizes of s to get faster results.
Samples
Get the approximate size information for a .Arguments
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
hypertable | REGCLASS | - | ✔ | Hypertable or continuous aggregate to show detailed approximate size of. |
Returns
| Column | Type | Description |
|---|---|---|
| table_bytes | BIGINT | Approximate disk space used by main_table (like pg_relation_size(main_table)) |
| index_bytes | BIGINT | Approximate disk space used by indexes |
| toast_bytes | BIGINT | Approximate disk space of toast tables |
| total_bytes | BIGINT | Approximate total disk space used by the specified table, including all indexes and TOAST data |
If executed on a relation that is not a hypertable, the function
returns
NULL.