hypertable_index_size()

Get size of an index on a hypertable. The size is reported in bytes.

Required Arguments

NameDescription
index_name(REGCLASS) Name of the index on a hypertable

Returns

(BIGINT) Returns disk space used by the index.

Sample Usage

Get size of a specific index on a hypertable.

  1. \d conditions_table
  2. Table "public.test_table"
  3. Column | Type | Collation | Nullable | Default
  4. --------+--------------------------+-----------+----------+---------
  5. time | timestamp with time zone | | not null |
  6. device | integer | | |
  7. volume | integer | | |
  8. Indexes:
  9. "second_index" btree ("time")
  10. "test_table_time_idx" btree ("time" DESC)
  11. "third_index" btree ("time")
  12. SELECT hypertable_index_size('second_index');
  13. hypertable_index_size
  14. -----------------------
  15. 163840
  16. SELECT pg_size_pretty(hypertable_index_size('second_index'));
  17. pg_size_pretty
  18. ----------------
  19. 160 kB