timescaledb_information.compression_settings

Get information about compression-related settings for hypertables. Each row of the view provides information about individual orderby and segmentby columns used by compression.

Available columns

NameTypeDescription
hypertable_schemaTEXTSchema name of the hypertable
hypertable_nameTEXTTable name of the hypertable
attnameTEXTName of the column used in the compression settings
segmentby_column_indexSMALLINTPosition of attname in the compress_segmentby list
orderby_column_indexSMALLINTPosition of attname in the compress_orderby list
orderby_ascBOOLEANTrue if this is used for order by ASC, False for order by DESC
orderby_nullsfirstBOOLEANTrue if nulls are ordered first for this column, False if nulls are ordered last

Sample usage

  1. CREATE TABLE hypertab (a_col integer, b_col integer, c_col integer, d_col integer, e_col integer);
  2. SELECT table_name FROM create_hypertable('hypertab', 'a_col', chunk_time_interval => 864000000);
  3. ALTER TABLE hypertab SET (timescaledb.compress, timescaledb.compress_segmentby = 'a_col,b_col',
  4. timescaledb.compress_orderby = 'c_col desc, d_col asc nulls last');
  5. SELECT * FROM timescaledb_information.compression_settings WHERE hypertable_name = 'hypertab';
  6. -[ RECORD 1 ]----------+---------
  7. hypertable_schema | public
  8. hypertable_name | hypertab
  9. attname | a_col
  10. segmentby_column_index | 1
  11. orderby_column_index |
  12. orderby_asc |
  13. orderby_nullsfirst |
  14. -[ RECORD 2 ]----------+---------
  15. hypertable_schema | public
  16. hypertable_name | hypertab
  17. attname | b_col
  18. segmentby_column_index | 2
  19. orderby_column_index |
  20. orderby_asc |
  21. orderby_nullsfirst |
  22. -[ RECORD 3 ]----------+---------
  23. hypertable_schema | public
  24. hypertable_name | hypertab
  25. attname | c_col
  26. segmentby_column_index |
  27. orderby_column_index | 1
  28. orderby_asc | f
  29. orderby_nullsfirst | t
  30. -[ RECORD 4 ]----------+---------
  31. hypertable_schema | public
  32. hypertable_name | hypertab
  33. attname | d_col
  34. segmentby_column_index |
  35. orderby_column_index | 2
  36. orderby_asc | t
  37. orderby_nullsfirst | f