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

NameTypeDescription
index_nameREGCLASSName of the index on a hypertable

Returns

ColumnTypeDescription
hypertable_index_sizeBIGINTReturns 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.

  1. \d conditions_table
  2. Table "public.conditions_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