-- This file and its contents are licensed under the Apache License 2.0. -- Please see the included NOTICE for copyright information and -- LICENSE-APACHE for a copy of the license. SELECT * FROM timescaledb_information.hypertables; hypertable_schema | hypertable_name | owner | num_dimensions | num_chunks | compression_enabled | is_distributed | replication_factor | data_nodes | tablespaces -------------------+-----------------+-------+----------------+------------+---------------------+----------------+--------------------+------------+------------- (0 rows) -- create simple hypertable with 1 chunk CREATE TABLE ht1(time TIMESTAMPTZ NOT NULL); SELECT create_hypertable('ht1','time'); create_hypertable ------------------- (1,public,ht1,t) (1 row) INSERT INTO ht1 SELECT '2000-01-01'::TIMESTAMPTZ; -- create simple hypertable with 1 chunk and toasted data CREATE TABLE ht2(time TIMESTAMPTZ NOT NULL, data TEXT); SELECT create_hypertable('ht2','time'); create_hypertable ------------------- (2,public,ht2,t) (1 row) INSERT INTO ht2 SELECT '2000-01-01'::TIMESTAMPTZ, repeat('8k',4096); SELECT * FROM timescaledb_information.hypertables ORDER BY hypertable_schema, hypertable_name; hypertable_schema | hypertable_name | owner | num_dimensions | num_chunks | compression_enabled | is_distributed | replication_factor | data_nodes | tablespaces -------------------+-----------------+-------------------+----------------+------------+---------------------+----------------+--------------------+------------+------------- public | ht1 | default_perm_user | 1 | 1 | f | f | | | public | ht2 | default_perm_user | 1 | 1 | f | f | | | (2 rows) \c :TEST_DBNAME :ROLE_SUPERUSER -- create schema open and hypertable with 3 chunks CREATE SCHEMA open; GRANT USAGE ON SCHEMA open TO :ROLE_DEFAULT_PERM_USER; CREATE TABLE open.open_ht(time TIMESTAMPTZ NOT NULL); SELECT create_hypertable('open.open_ht','time'); create_hypertable -------------------- (3,open,open_ht,t) (1 row) INSERT INTO open.open_ht SELECT '2000-01-01'::TIMESTAMPTZ; INSERT INTO open.open_ht SELECT '2001-01-01'::TIMESTAMPTZ; INSERT INTO open.open_ht SELECT '2002-01-01'::TIMESTAMPTZ; -- create schema closed and hypertable CREATE SCHEMA closed; CREATE TABLE closed.closed_ht(time TIMESTAMPTZ NOT NULL); SELECT create_hypertable('closed.closed_ht','time'); create_hypertable ------------------------ (4,closed,closed_ht,t) (1 row) INSERT INTO closed.closed_ht SELECT '2000-01-01'::TIMESTAMPTZ; SELECT * FROM timescaledb_information.hypertables ORDER BY hypertable_schema, hypertable_name; hypertable_schema | hypertable_name | owner | num_dimensions | num_chunks | compression_enabled | is_distributed | replication_factor | data_nodes | tablespaces -------------------+-----------------+-------------------+----------------+------------+---------------------+----------------+--------------------+------------+------------- closed | closed_ht | super_user | 1 | 1 | f | f | | | open | open_ht | super_user | 1 | 3 | f | f | | | public | ht1 | default_perm_user | 1 | 1 | f | f | | | public | ht2 | default_perm_user | 1 | 1 | f | f | | | (4 rows) \c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER \set ON_ERROR_STOP 0 \x SELECT * FROM timescaledb_information.hypertables ORDER BY hypertable_schema, hypertable_name; -[ RECORD 1 ]-------+------------------ hypertable_schema | closed hypertable_name | closed_ht owner | super_user num_dimensions | 1 num_chunks | 1 compression_enabled | f is_distributed | f replication_factor | data_nodes | tablespaces | -[ RECORD 2 ]-------+------------------ hypertable_schema | open hypertable_name | open_ht owner | super_user num_dimensions | 1 num_chunks | 3 compression_enabled | f is_distributed | f replication_factor | data_nodes | tablespaces | -[ RECORD 3 ]-------+------------------ hypertable_schema | public hypertable_name | ht1 owner | default_perm_user num_dimensions | 1 num_chunks | 1 compression_enabled | f is_distributed | f replication_factor | data_nodes | tablespaces | -[ RECORD 4 ]-------+------------------ hypertable_schema | public hypertable_name | ht2 owner | default_perm_user num_dimensions | 1 num_chunks | 1 compression_enabled | f is_distributed | f replication_factor | data_nodes | tablespaces | -- filter by schema SELECT * FROM timescaledb_information.hypertables WHERE hypertable_schema = 'closed' ORDER BY hypertable_schema, hypertable_name; -[ RECORD 1 ]-------+----------- hypertable_schema | closed hypertable_name | closed_ht owner | super_user num_dimensions | 1 num_chunks | 1 compression_enabled | f is_distributed | f replication_factor | data_nodes | tablespaces | -- filter by table name SELECT * FROM timescaledb_information.hypertables WHERE hypertable_name = 'ht1' ORDER BY hypertable_schema, hypertable_name; -[ RECORD 1 ]-------+------------------ hypertable_schema | public hypertable_name | ht1 owner | default_perm_user num_dimensions | 1 num_chunks | 1 compression_enabled | f is_distributed | f replication_factor | data_nodes | tablespaces | -- filter by owner SELECT * FROM timescaledb_information.hypertables WHERE owner = 'super_user' ORDER BY hypertable_schema, hypertable_name; -[ RECORD 1 ]-------+----------- hypertable_schema | closed hypertable_name | closed_ht owner | super_user num_dimensions | 1 num_chunks | 1 compression_enabled | f is_distributed | f replication_factor | data_nodes | tablespaces | -[ RECORD 2 ]-------+----------- hypertable_schema | open hypertable_name | open_ht owner | super_user num_dimensions | 1 num_chunks | 3 compression_enabled | f is_distributed | f replication_factor | data_nodes | tablespaces | \x ---Add integer table -- CREATE TABLE test_table_int(time bigint, junk int); SELECT create_hypertable('test_table_int', 'time', chunk_time_interval => 10); NOTICE: adding not-null constraint to column "time" create_hypertable ----------------------------- (5,public,test_table_int,t) (1 row) CREATE OR REPLACE function table_int_now() returns BIGINT LANGUAGE SQL IMMUTABLE as 'SELECT 1::BIGINT'; SELECT set_integer_now_func('test_table_int', 'table_int_now'); set_integer_now_func ---------------------- (1 row) INSERT into test_table_int SELECT generate_series( 1, 20), 100; SELECT * FROM timescaledb_information.chunks WHERE hypertable_name = 'ht1' ORDER BY chunk_name; hypertable_schema | hypertable_name | chunk_schema | chunk_name | primary_dimension | primary_dimension_type | range_start | range_end | range_start_integer | range_end_integer | is_compressed | chunk_tablespace | data_nodes -------------------+-----------------+-----------------------+------------------+-------------------+--------------------------+------------------------------+------------------------------+---------------------+-------------------+---------------+------------------+------------ public | ht1 | _timescaledb_internal | _hyper_1_1_chunk | time | timestamp with time zone | Wed Dec 29 16:00:00 1999 PST | Wed Jan 05 16:00:00 2000 PST | | | f | | (1 row) SELECT * FROM timescaledb_information.chunks WHERE hypertable_name = 'test_table_int' ORDER BY chunk_name; hypertable_schema | hypertable_name | chunk_schema | chunk_name | primary_dimension | primary_dimension_type | range_start | range_end | range_start_integer | range_end_integer | is_compressed | chunk_tablespace | data_nodes -------------------+-----------------+-----------------------+------------------+-------------------+------------------------+-------------+-----------+---------------------+-------------------+---------------+------------------+------------ public | test_table_int | _timescaledb_internal | _hyper_5_7_chunk | time | bigint | | | 0 | 10 | f | | public | test_table_int | _timescaledb_internal | _hyper_5_8_chunk | time | bigint | | | 10 | 20 | f | | public | test_table_int | _timescaledb_internal | _hyper_5_9_chunk | time | bigint | | | 20 | 30 | f | | (3 rows) \x SELECT * FROM timescaledb_information.dimensions ORDER BY hypertable_name, dimension_number; -[ RECORD 1 ]-----+------------------------- hypertable_schema | closed hypertable_name | closed_ht dimension_number | 1 column_name | time column_type | timestamp with time zone dimension_type | Time time_interval | @ 7 days integer_interval | integer_now_func | num_partitions | -[ RECORD 2 ]-----+------------------------- hypertable_schema | public hypertable_name | ht1 dimension_number | 1 column_name | time column_type | timestamp with time zone dimension_type | Time time_interval | @ 7 days integer_interval | integer_now_func | num_partitions | -[ RECORD 3 ]-----+------------------------- hypertable_schema | public hypertable_name | ht2 dimension_number | 1 column_name | time column_type | timestamp with time zone dimension_type | Time time_interval | @ 7 days integer_interval | integer_now_func | num_partitions | -[ RECORD 4 ]-----+------------------------- hypertable_schema | open hypertable_name | open_ht dimension_number | 1 column_name | time column_type | timestamp with time zone dimension_type | Time time_interval | @ 7 days integer_interval | integer_now_func | num_partitions | -[ RECORD 5 ]-----+------------------------- hypertable_schema | public hypertable_name | test_table_int dimension_number | 1 column_name | time column_type | bigint dimension_type | Time time_interval | integer_interval | 10 integer_now_func | table_int_now num_partitions | \x