hypertable_index_size()
Get the disk space used by an index on a hypertable, including the disk space needed to provide the index on all chunks. The size is reported in bytes.
Required arguments
| Name | Type | Description |
|---|---|---|
index_name |
REGCLASS | Name of the index on a hypertable |
Returns
| Column | Type | Description |
|---|---|---|
| hypertable_index_size | BIGINT | Returns the disk space used by the index |
tip
NULL is returned if the function is executed on a non-hypertable relation.
Sample usage
Get size of a specific index on a hypertable.
2. \d conditions_table
4. Table "public.conditions_table"
6. Column | Type | Collation | Nullable | Default
9. --------+--------------------------+-----------+----------+---------
11. time | timestamp with time zone | | not null |
14. device | integer | | |
17. volume | integer | | |
20. Indexes:
22. "second_index" btree ("time")
24. "test_table_time_idx" btree ("time" DESC)
26. "third_index" btree ("time")
28. SELECT hypertable_index_size('second_index');
30. hypertable_index_size
33. -----------------------
35. 163840
37. SELECT pg_size_pretty(hypertable_index_size('second_index'));
39. pg_size_pretty
42. ----------------
44. 160 kB
