diff --git a/sql/chunk.sql b/sql/chunk.sql index 624c15952..6a7eff91d 100644 --- a/sql/chunk.sql +++ b/sql/chunk.sql @@ -49,17 +49,6 @@ CREATE OR REPLACE FUNCTION _timescaledb_functions.create_chunk( RETURNS TABLE(chunk_id INTEGER, hypertable_id INTEGER, schema_name NAME, table_name NAME, relkind "char", slices JSONB, created BOOLEAN) AS '@MODULE_PATHNAME@', 'ts_chunk_create' LANGUAGE C VOLATILE; --- Get chunk stats. -CREATE OR REPLACE FUNCTION _timescaledb_functions.get_chunk_relstats(relid REGCLASS) -RETURNS TABLE(chunk_id INTEGER, hypertable_id INTEGER, num_pages INTEGER, num_tuples REAL, num_allvisible INTEGER) -AS '@MODULE_PATHNAME@', 'ts_chunk_get_relstats' LANGUAGE C VOLATILE; - -CREATE OR REPLACE FUNCTION _timescaledb_functions.get_chunk_colstats(relid REGCLASS) -RETURNS TABLE(chunk_id INTEGER, hypertable_id INTEGER, att_num INTEGER, nullfrac REAL, width INTEGER, distinctval REAL, slotkind INTEGER[], slotopstrings CSTRING[], slotcollations OID[], -slot1numbers FLOAT4[], slot2numbers FLOAT4[], slot3numbers FLOAT4[], slot4numbers FLOAT4[], slot5numbers FLOAT4[], -slotvaluetypetrings CSTRING[], slot1values CSTRING[], slot2values CSTRING[], slot3values CSTRING[], slot4values CSTRING[], slot5values CSTRING[]) -AS '@MODULE_PATHNAME@', 'ts_chunk_get_colstats' LANGUAGE C VOLATILE; - CREATE OR REPLACE FUNCTION _timescaledb_functions.create_chunk_table( hypertable REGCLASS, slices JSONB, diff --git a/sql/compat.sql b/sql/compat.sql index 70c334b82..83953e60f 100644 --- a/sql/compat.sql +++ b/sql/compat.sql @@ -258,26 +258,6 @@ END$$ SET search_path TO pg_catalog,pg_temp; -CREATE OR REPLACE FUNCTION _timescaledb_internal.get_chunk_colstats(relid regclass) RETURNS TABLE(chunk_id INTEGER, hypertable_id INTEGER, att_num INTEGER, nullfrac REAL, width INTEGER, distinctval REAL, slotkind INTEGER[], slotopstrings CSTRING[], slotcollations OID[], slot1numbers FLOAT4[], slot2numbers FLOAT4[], slot3numbers FLOAT4[], slot4numbers FLOAT4[], slot5numbers FLOAT4[], slotvaluetypetrings CSTRING[], slot1values CSTRING[], slot2values CSTRING[], slot3values CSTRING[], slot4values CSTRING[], slot5values CSTRING[]) LANGUAGE PLPGSQL AS $$ -BEGIN - IF current_setting('timescaledb.enable_deprecation_warnings', true)::bool THEN - RAISE WARNING 'function _timescaledb_internal.get_chunk_colstats(regclass) is deprecated and has been moved to _timescaledb_functions schema. this compatibility function will be removed in a future version.'; - END IF; - RETURN QUERY SELECT * FROM _timescaledb_functions.get_chunk_colstats($1); -END$$ -SET search_path TO pg_catalog,pg_temp; - - -CREATE OR REPLACE FUNCTION _timescaledb_internal.get_chunk_relstats(relid regclass) RETURNS TABLE(chunk_id INTEGER, hypertable_id INTEGER, num_pages INTEGER, num_tuples REAL, num_allvisible INTEGER) LANGUAGE PLPGSQL AS $$ -BEGIN - IF current_setting('timescaledb.enable_deprecation_warnings', true)::bool THEN - RAISE WARNING 'function _timescaledb_internal.get_chunk_relstats(regclass) is deprecated and has been moved to _timescaledb_functions schema. this compatibility function will be removed in a future version.'; - END IF; - RETURN QUERY SELECT * FROM _timescaledb_functions.get_chunk_relstats($1); -END$$ -SET search_path TO pg_catalog,pg_temp; - - CREATE OR REPLACE FUNCTION _timescaledb_internal.get_compressed_chunk_index_for_recompression(uncompressed_chunk regclass) RETURNS regclass LANGUAGE PLPGSQL AS $$ BEGIN IF current_setting('timescaledb.enable_deprecation_warnings', true)::bool THEN diff --git a/sql/updates/latest-dev.sql b/sql/updates/latest-dev.sql index f6ec6c1cc..6ba3ab3ad 100644 --- a/sql/updates/latest-dev.sql +++ b/sql/updates/latest-dev.sql @@ -155,3 +155,10 @@ UPDATE _timescaledb_catalog.continuous_aggs_bucket_function SET bucket_timezone -- So far, there were no difference between 0 and -1 retries. Since now on, 0 means no retries. Updating the retry -- count of existing jobs to -1 to keep the current semantics. UPDATE _timescaledb_config.bgw_job SET max_retries = -1 WHERE max_retries = 0; + +DROP FUNCTION IF EXISTS _timescaledb_functions.get_chunk_relstats; +DROP FUNCTION IF EXISTS _timescaledb_functions.get_chunk_colstats; +DROP FUNCTION IF EXISTS _timescaledb_internal.get_chunk_relstats; +DROP FUNCTION IF EXISTS _timescaledb_internal.get_chunk_colstats; + + diff --git a/sql/updates/reverse-dev.sql b/sql/updates/reverse-dev.sql index 9f9a53f77..30c4ac194 100644 --- a/sql/updates/reverse-dev.sql +++ b/sql/updates/reverse-dev.sql @@ -60,3 +60,14 @@ ANALYZE _timescaledb_catalog.continuous_aggs_bucket_function; UPDATE _timescaledb_catalog.continuous_aggs_bucket_function SET origin = origin::timestamptz::timestamp::text WHERE length(origin) > 1; + +-- only create stub +CREATE FUNCTION _timescaledb_functions.get_chunk_relstats(relid REGCLASS) +RETURNS TABLE(chunk_id INTEGER, hypertable_id INTEGER, num_pages INTEGER, num_tuples REAL, num_allvisible INTEGER) +AS $$BEGIN END$$ LANGUAGE plpgsql SET search_path = pg_catalog, pg_temp; + +CREATE FUNCTION _timescaledb_functions.get_chunk_colstats(relid REGCLASS) +RETURNS TABLE(chunk_id INTEGER, hypertable_id INTEGER, att_num INTEGER, nullfrac REAL, width INTEGER, distinctval REAL, slotkind INTEGER[], slotopstrings CSTRING[], slotcollations OID[], slot1numbers FLOAT4[], slot2numbers FLOAT4[], slot3numbers FLOAT4[], slot4numbers FLOAT4[], slot5numbers FLOAT4[], slotvaluetypetrings CSTRING[], slot1values CSTRING[], slot2values CSTRING[], slot3values CSTRING[], slot4values CSTRING[], slot5values CSTRING[]) +AS $$BEGIN END$$ LANGUAGE plpgsql SET search_path = pg_catalog, pg_temp; + + diff --git a/src/cross_module_fn.c b/src/cross_module_fn.c index c8d15cc6f..8482b901d 100644 --- a/src/cross_module_fn.c +++ b/src/cross_module_fn.c @@ -88,8 +88,6 @@ CROSSMODULE_WRAPPER(cagg_try_repair); CROSSMODULE_WRAPPER(chunk_freeze_chunk); CROSSMODULE_WRAPPER(chunk_unfreeze_chunk); -CROSSMODULE_WRAPPER(chunk_get_relstats); -CROSSMODULE_WRAPPER(chunk_get_colstats); CROSSMODULE_WRAPPER(chunk_create_empty_table); CROSSMODULE_WRAPPER(recompress_chunk_segmentwise); @@ -364,8 +362,6 @@ TSDLLEXPORT CrossModuleFunctions ts_cm_functions_default = { .create_chunk = error_no_default_fn_pg_community, .chunk_freeze_chunk = error_no_default_fn_pg_community, .chunk_unfreeze_chunk = error_no_default_fn_pg_community, - .chunk_get_relstats = error_no_default_fn_pg_community, - .chunk_get_colstats = error_no_default_fn_pg_community, .chunk_create_empty_table = error_no_default_fn_pg_community, .recompress_chunk_segmentwise = error_no_default_fn_pg_community, .get_compressed_chunk_index_for_recompression = error_no_default_fn_pg_community, diff --git a/src/cross_module_fn.h b/src/cross_module_fn.h index 831d34ee3..c443bcab1 100644 --- a/src/cross_module_fn.h +++ b/src/cross_module_fn.h @@ -144,8 +144,6 @@ typedef struct CrossModuleFunctions PGFunction create_chunk; PGFunction show_chunk; - PGFunction chunk_get_relstats; - PGFunction chunk_get_colstats; PGFunction chunk_create_empty_table; PGFunction chunk_freeze_chunk; PGFunction chunk_unfreeze_chunk; diff --git a/tsl/src/init.c b/tsl/src/init.c index 57d631c62..f43a7c2e4 100644 --- a/tsl/src/init.c +++ b/tsl/src/init.c @@ -168,8 +168,6 @@ CrossModuleFunctions tsl_cm_functions = { .chunk_freeze_chunk = chunk_freeze_chunk, .chunk_unfreeze_chunk = chunk_unfreeze_chunk, .set_rel_pathlist = tsl_set_rel_pathlist, - .chunk_get_relstats = chunk_api_get_chunk_relstats, - .chunk_get_colstats = chunk_api_get_chunk_colstats, .chunk_create_empty_table = chunk_create_empty_table, .recompress_chunk_segmentwise = tsl_recompress_chunk_segmentwise, .get_compressed_chunk_index_for_recompression = diff --git a/tsl/test/expected/chunk_api.out b/tsl/test/expected/chunk_api.out index 1051f479e..85796cffd 100644 --- a/tsl/test/expected/chunk_api.out +++ b/tsl/test/expected/chunk_api.out @@ -6,9 +6,8 @@ GRANT CREATE ON DATABASE :"TEST_DBNAME" TO :ROLE_DEFAULT_PERM_USER; SET ROLE :ROLE_DEFAULT_PERM_USER; CREATE SCHEMA "ChunkSchema"; -- Use range types as well for columns -CREATE TABLE chunkapi (time timestamptz, device int, temp float, rng int8range); +CREATE TABLE chunkapi(time timestamptz not null, device int, temp float, rng int8range); SELECT * FROM create_hypertable('chunkapi', 'time', 'device', 2); -NOTICE: adding not-null constraint to column "time" hypertable_id | schema_name | table_name | created ---------------+-------------+------------+--------- 1 | public | chunkapi | t @@ -128,131 +127,6 @@ SELECT * FROM _timescaledb_functions.create_chunk('chunkapi',' {"time": [1515024 (1 row) SET ROLE :ROLE_DEFAULT_PERM_USER; -\set VERBOSITY terse -SELECT (_timescaledb_functions.show_chunk(show_chunks)).* -FROM show_chunks('chunkapi') -ORDER BY chunk_id; - chunk_id | hypertable_id | schema_name | table_name | relkind | slices -----------+---------------+-----------------------+---------------------+---------+---------------------------------------------------------------------------------------------- - 1 | 1 | _timescaledb_internal | _hyper_1_1_chunk | r | {"time": [1514419200000000, 1515024000000000], "device": [-9223372036854775808, 1073741823]} - 2 | 1 | ChunkSchema | My_chunk_Table_name | r | {"time": [1515024000000000, 1519024000000000], "device": [-9223372036854775808, 1073741823]} -(2 rows) - --- Show the new chunks -\dt public.* - List of relations - Schema | Name | Type | Owner ---------+----------+-------+------------------- - public | chunkapi | table | default_perm_user -(1 row) - -\dt "ChunkSchema".* - List of relations - Schema | Name | Type | Owner --------------+---------------------+-------+------------------- - ChunkSchema | My_chunk_Table_name | table | default_perm_user -(1 row) - --- Make ANALYZE deterministic -SELECT setseed(1); - setseed ---------- - -(1 row) - --- Test getting relation stats for chunks. First get stats --- chunk-by-chunk. Note that the table isn't ANALYZED, so no stats --- present yet. -SELECT (_timescaledb_functions.get_chunk_relstats(show_chunks)).* -FROM show_chunks('chunkapi') -ORDER BY chunk_id; - chunk_id | hypertable_id | num_pages | num_tuples | num_allvisible -----------+---------------+-----------+------------+---------------- - 1 | 1 | 0 | 0 | 0 - 2 | 1 | 0 | 0 | 0 -(2 rows) - -SELECT (_timescaledb_functions.get_chunk_colstats(show_chunks)).* -FROM show_chunks('chunkapi') -ORDER BY chunk_id; - chunk_id | hypertable_id | att_num | nullfrac | width | distinctval | slotkind | slotopstrings | slotcollations | slot1numbers | slot2numbers | slot3numbers | slot4numbers | slot5numbers | slotvaluetypetrings | slot1values | slot2values | slot3values | slot4values | slot5values -----------+---------------+---------+----------+-------+-------------+----------+---------------+----------------+--------------+--------------+--------------+--------------+--------------+---------------------+-------------+-------------+-------------+-------------+------------- -(0 rows) - --- Get the same stats but by giving the hypertable as input -SELECT * FROM _timescaledb_functions.get_chunk_relstats('chunkapi'); - chunk_id | hypertable_id | num_pages | num_tuples | num_allvisible -----------+---------------+-----------+------------+---------------- - 1 | 1 | 0 | 0 | 0 - 2 | 1 | 0 | 0 | 0 -(2 rows) - -SELECT * FROM _timescaledb_functions.get_chunk_colstats('chunkapi'); - chunk_id | hypertable_id | att_num | nullfrac | width | distinctval | slotkind | slotopstrings | slotcollations | slot1numbers | slot2numbers | slot3numbers | slot4numbers | slot5numbers | slotvaluetypetrings | slot1values | slot2values | slot3values | slot4values | slot5values -----------+---------------+---------+----------+-------+-------------+----------+---------------+----------------+--------------+--------------+--------------+--------------+--------------+---------------------+-------------+-------------+-------------+-------------+------------- -(0 rows) - --- reltuples is -1 on PG14 when no VACUUM/ANALYZE has run yet -SELECT relname, CASE WHEN reltuples > 0 THEN reltuples ELSE 0 END AS reltuples, relpages, relallvisible FROM pg_class WHERE relname IN -(SELECT (_timescaledb_functions.show_chunk(show_chunks)).table_name - FROM show_chunks('chunkapi')) -ORDER BY relname; - relname | reltuples | relpages | relallvisible ----------------------+-----------+----------+--------------- - My_chunk_Table_name | 0 | 0 | 0 - _hyper_1_1_chunk | 0 | 0 | 0 -(2 rows) - -SELECT tablename, attname, inherited, null_frac, avg_width, n_distinct -FROM pg_stats WHERE tablename IN -(SELECT (_timescaledb_functions.show_chunk(show_chunks)).table_name - FROM show_chunks('chunkapi')) -ORDER BY tablename, attname; - tablename | attname | inherited | null_frac | avg_width | n_distinct ------------+---------+-----------+-----------+-----------+------------ -(0 rows) - --- Show stats after analyze -ANALYZE chunkapi; -SELECT * FROM _timescaledb_functions.get_chunk_relstats('chunkapi'); - chunk_id | hypertable_id | num_pages | num_tuples | num_allvisible -----------+---------------+-----------+------------+---------------- - 1 | 1 | 1 | 1 | 0 - 2 | 1 | 0 | 0 | 0 -(2 rows) - -SELECT * FROM _timescaledb_functions.get_chunk_colstats('chunkapi'); - chunk_id | hypertable_id | att_num | nullfrac | width | distinctval | slotkind | slotopstrings | slotcollations | slot1numbers | slot2numbers | slot3numbers | slot4numbers | slot5numbers | slotvaluetypetrings | slot1values | slot2values | slot3values | slot4values | slot5values -----------+---------------+---------+----------+-------+-------------+-------------+----------------------------------------------------+----------------+--------------+--------------+--------------+--------------+--------------+---------------------+-------------+-------------+-------------+-------------+------------- - 1 | 1 | 1 | 0 | 8 | -1 | {0,0,0,0,0} | {} | {0,0,0,0,0} | | | | | | {} | | | | | - 1 | 1 | 2 | 0 | 4 | -1 | {0,0,0,0,0} | {} | {0,0,0,0,0} | | | | | | {} | | | | | - 1 | 1 | 3 | 0 | 8 | -1 | {0,0,0,0,0} | {} | {0,0,0,0,0} | | | | | | {} | | | | | - 1 | 1 | 4 | 0 | 22 | -1 | {6,0,0,0,0} | {<,pg_catalog,float8,pg_catalog,float8,pg_catalog} | {0,0,0,0,0} | {0} | | | | | {} | | | | | -(4 rows) - -SELECT relname, reltuples, relpages, relallvisible FROM pg_class WHERE relname IN -(SELECT (_timescaledb_functions.show_chunk(show_chunks)).table_name - FROM show_chunks('chunkapi')) -ORDER BY relname; - relname | reltuples | relpages | relallvisible ----------------------+-----------+----------+--------------- - My_chunk_Table_name | 0 | 0 | 0 - _hyper_1_1_chunk | 1 | 1 | 0 -(2 rows) - -SELECT tablename, attname, inherited, null_frac, avg_width, n_distinct -FROM pg_stats WHERE tablename IN -(SELECT (_timescaledb_functions.show_chunk(show_chunks)).table_name -FROM show_chunks('chunkapi')) -ORDER BY tablename, attname; - tablename | attname | inherited | null_frac | avg_width | n_distinct -------------------+---------+-----------+-----------+-----------+------------ - _hyper_1_1_chunk | device | f | 0 | 4 | -1 - _hyper_1_1_chunk | rng | f | 0 | 22 | -1 - _hyper_1_1_chunk | temp | f | 0 | 8 | -1 - _hyper_1_1_chunk | time | f | 0 | 8 | -1 -(4 rows) - -- Test create_chunk_table to recreate the chunk table and show dimension slices SET ROLE :ROLE_DEFAULT_PERM_USER; SELECT * FROM chunkapi ORDER BY time; @@ -320,9 +194,8 @@ ERROR: relation "_hyper_1_1_chunk" already exists -- Test create_chunk_table on a hypertable where the chunk didn't exist before DROP TABLE chunkapi; DROP TABLE :CHUNK_SCHEMA.:CHUNK_NAME; -CREATE TABLE chunkapi (time timestamptz, device int, temp float); +CREATE TABLE chunkapi(time timestamptz not null, device int, temp float); SELECT * FROM create_hypertable('chunkapi', 'time', 'device', 2); -NOTICE: adding not-null constraint to column "time" hypertable_id | schema_name | table_name | created ---------------+-------------+------------+--------- 2 | public | chunkapi | t diff --git a/tsl/test/shared/expected/compat.out b/tsl/test/shared/expected/compat.out index a98466671..8bc836662 100644 --- a/tsl/test/shared/expected/compat.out +++ b/tsl/test/shared/expected/compat.out @@ -79,12 +79,6 @@ WARNING: function _timescaledb_internal.get_approx_row_count(regclass) is depre 0 (1 row) -SELECT _timescaledb_internal.get_chunk_colstats(0); -WARNING: function _timescaledb_internal.get_chunk_colstats(regclass) is deprecated and has been moved to _timescaledb_functions schema. this compatibility function will be removed in a future version. -ERROR: invalid table -SELECT _timescaledb_internal.get_chunk_relstats(0); -WARNING: function _timescaledb_internal.get_chunk_relstats(regclass) is deprecated and has been moved to _timescaledb_functions schema. this compatibility function will be removed in a future version. -ERROR: invalid table SELECT _timescaledb_internal.get_compressed_chunk_index_for_recompression(0); WARNING: function _timescaledb_internal.get_compressed_chunk_index_for_recompression(regclass) is deprecated and has been moved to _timescaledb_functions schema. this compatibility function will be removed in a future version. ERROR: invalid Oid diff --git a/tsl/test/shared/expected/extension.out b/tsl/test/shared/expected/extension.out index a7ff88426..eaef5a9d1 100644 --- a/tsl/test/shared/expected/extension.out +++ b/tsl/test/shared/expected/extension.out @@ -68,8 +68,6 @@ ORDER BY pronamespace::regnamespace::text COLLATE "C", p.oid::regprocedure::text _timescaledb_functions.freeze_chunk(regclass) _timescaledb_functions.generate_uuid() _timescaledb_functions.get_approx_row_count(regclass) - _timescaledb_functions.get_chunk_colstats(regclass) - _timescaledb_functions.get_chunk_relstats(regclass) _timescaledb_functions.get_compressed_chunk_index_for_recompression(regclass) _timescaledb_functions.get_create_command(name) _timescaledb_functions.get_git_commit() @@ -161,8 +159,6 @@ ORDER BY pronamespace::regnamespace::text COLLATE "C", p.oid::regprocedure::text _timescaledb_internal.freeze_chunk(regclass) _timescaledb_internal.generate_uuid() _timescaledb_internal.get_approx_row_count(regclass) - _timescaledb_internal.get_chunk_colstats(regclass) - _timescaledb_internal.get_chunk_relstats(regclass) _timescaledb_internal.get_compressed_chunk_index_for_recompression(regclass) _timescaledb_internal.get_create_command(name) _timescaledb_internal.get_git_commit() diff --git a/tsl/test/shared/sql/compat.sql b/tsl/test/shared/sql/compat.sql index b61b93d44..d9cb9af3c 100644 --- a/tsl/test/shared/sql/compat.sql +++ b/tsl/test/shared/sql/compat.sql @@ -25,8 +25,6 @@ SELECT _timescaledb_internal.drop_chunk(0); SELECT _timescaledb_internal.freeze_chunk(0); SELECT FROM _timescaledb_internal.generate_uuid(); SELECT _timescaledb_internal.get_approx_row_count(0); -SELECT _timescaledb_internal.get_chunk_colstats(0); -SELECT _timescaledb_internal.get_chunk_relstats(0); SELECT _timescaledb_internal.get_compressed_chunk_index_for_recompression(0); SELECT _timescaledb_internal.get_create_command(NULL); SELECT pg_typeof(_timescaledb_internal.get_git_commit()); diff --git a/tsl/test/sql/chunk_api.sql b/tsl/test/sql/chunk_api.sql index ac0a6ec5f..5adeb5ba5 100644 --- a/tsl/test/sql/chunk_api.sql +++ b/tsl/test/sql/chunk_api.sql @@ -8,7 +8,7 @@ SET ROLE :ROLE_DEFAULT_PERM_USER; CREATE SCHEMA "ChunkSchema"; -- Use range types as well for columns -CREATE TABLE chunkapi (time timestamptz, device int, temp float, rng int8range); +CREATE TABLE chunkapi(time timestamptz not null, device int, temp float, rng int8range); SELECT * FROM create_hypertable('chunkapi', 'time', 'device', 2); @@ -78,61 +78,6 @@ SELECT * FROM _timescaledb_functions.create_chunk('chunkapi',' {"time": [1515024 SET ROLE :ROLE_DEFAULT_PERM_USER; -\set VERBOSITY terse - -SELECT (_timescaledb_functions.show_chunk(show_chunks)).* -FROM show_chunks('chunkapi') -ORDER BY chunk_id; - --- Show the new chunks -\dt public.* -\dt "ChunkSchema".* - --- Make ANALYZE deterministic -SELECT setseed(1); - --- Test getting relation stats for chunks. First get stats --- chunk-by-chunk. Note that the table isn't ANALYZED, so no stats --- present yet. -SELECT (_timescaledb_functions.get_chunk_relstats(show_chunks)).* -FROM show_chunks('chunkapi') -ORDER BY chunk_id; -SELECT (_timescaledb_functions.get_chunk_colstats(show_chunks)).* -FROM show_chunks('chunkapi') -ORDER BY chunk_id; - --- Get the same stats but by giving the hypertable as input -SELECT * FROM _timescaledb_functions.get_chunk_relstats('chunkapi'); -SELECT * FROM _timescaledb_functions.get_chunk_colstats('chunkapi'); - --- reltuples is -1 on PG14 when no VACUUM/ANALYZE has run yet -SELECT relname, CASE WHEN reltuples > 0 THEN reltuples ELSE 0 END AS reltuples, relpages, relallvisible FROM pg_class WHERE relname IN -(SELECT (_timescaledb_functions.show_chunk(show_chunks)).table_name - FROM show_chunks('chunkapi')) -ORDER BY relname; - -SELECT tablename, attname, inherited, null_frac, avg_width, n_distinct -FROM pg_stats WHERE tablename IN -(SELECT (_timescaledb_functions.show_chunk(show_chunks)).table_name - FROM show_chunks('chunkapi')) -ORDER BY tablename, attname; - --- Show stats after analyze -ANALYZE chunkapi; -SELECT * FROM _timescaledb_functions.get_chunk_relstats('chunkapi'); -SELECT * FROM _timescaledb_functions.get_chunk_colstats('chunkapi'); - -SELECT relname, reltuples, relpages, relallvisible FROM pg_class WHERE relname IN -(SELECT (_timescaledb_functions.show_chunk(show_chunks)).table_name - FROM show_chunks('chunkapi')) -ORDER BY relname; - -SELECT tablename, attname, inherited, null_frac, avg_width, n_distinct -FROM pg_stats WHERE tablename IN -(SELECT (_timescaledb_functions.show_chunk(show_chunks)).table_name -FROM show_chunks('chunkapi')) -ORDER BY tablename, attname; - -- Test create_chunk_table to recreate the chunk table and show dimension slices SET ROLE :ROLE_DEFAULT_PERM_USER; @@ -175,7 +120,7 @@ SELECT * FROM _timescaledb_functions.create_chunk('chunkapi', :'SLICES', :'CHUNK DROP TABLE chunkapi; DROP TABLE :CHUNK_SCHEMA.:CHUNK_NAME; -CREATE TABLE chunkapi (time timestamptz, device int, temp float); +CREATE TABLE chunkapi(time timestamptz not null, device int, temp float); SELECT * FROM create_hypertable('chunkapi', 'time', 'device', 2); SELECT count(*) FROM