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

Name Type Description
hypertable_schema TEXT Schema name of the hypertable
hypertable_name TEXT Table name of the hypertable
attname TEXT Name of the column used in the compression settings
segmentby_column_index SMALLINT Position of attname in the compress_segmentby list
orderby_column_index SMALLINT Position of attname in the compress_orderby list
orderby_asc BOOLEAN True if this is used for order by ASC, False for order by DESC
orderby_nullsfirst BOOLEAN True if nulls are ordered first for this column, False if nulls are ordered last

Sample usage

2. CREATE TABLE hypertab (a_col integer, b_col integer, c_col integer, d_col integer, e_col integer);

4. SELECT table_name FROM create_hypertable('hypertab', 'a_col', chunk_time_interval => 864000000);

6. ALTER TABLE hypertab SET (timescaledb.compress, timescaledb.compress_segmentby = 'a_col,b_col',

9. timescaledb.compress_orderby = 'c_col desc, d_col asc nulls last');

11. SELECT * FROM timescaledb_information.compression_settings WHERE hypertable_name = 'hypertab';

13. -[ RECORD 1 ]----------+---------

15. hypertable_schema      | public

17. hypertable_name        | hypertab

19. attname                | a_col

21. segmentby_column_index | 1

23. orderby_column_index   |

26. orderby_asc            |

29. orderby_nullsfirst     |

32. -[ RECORD 2 ]----------+---------

34. hypertable_schema      | public

36. hypertable_name        | hypertab

38. attname                | b_col

40. segmentby_column_index | 2

42. orderby_column_index   |

45. orderby_asc            |

48. orderby_nullsfirst     |

51. -[ RECORD 3 ]----------+---------

53. hypertable_schema      | public

55. hypertable_name        | hypertab

57. attname                | c_col

59. segmentby_column_index |

62. orderby_column_index   | 1

64. orderby_asc            | f

66. orderby_nullsfirst     | t

68. -[ RECORD 4 ]----------+---------

70. hypertable_schema      | public

72. hypertable_name        | hypertab

74. attname                | d_col

76. segmentby_column_index |

79. orderby_column_index   | 2

81. orderby_asc            | t

83. orderby_nullsfirst     | f