Merged in olof_rensfelt/backend-database/ore/drop_table (pull request #30)

Drop hypertable added
This commit is contained in:
Olof Rensfelt 2017-01-16 21:08:44 +01:00
commit 6cc0b103de
32 changed files with 1289 additions and 439 deletions

View File

@ -1,3 +0,0 @@
-- CREATE EXTENSION IF NOT EXISTS dblink;
-- CREATE EXTENSION IF NOT EXISTS postgres_fdw;
-- CREATE EXTENSION IF NOT EXISTS hashlib;

View File

@ -80,7 +80,7 @@ CREATE TABLE IF NOT EXISTS hypertable (
-- Parent: hypertable's `distinct root table`
-- Children: created by `distinct_replica_node` table
CREATE TABLE IF NOT EXISTS hypertable_replica (
hypertable_name NAME NOT NULL REFERENCES hypertable (name),
hypertable_name NAME NOT NULL REFERENCES hypertable (name) ON DELETE CASCADE,
replica_id SMALLINT NOT NULL CHECK (replica_id >= 0),
schema_name NAME NOT NULL,
table_name NAME NOT NULL,
@ -96,7 +96,7 @@ CREATE TABLE IF NOT EXISTS hypertable_replica (
-- (Postgres RULES cannot be used, unfortunately)
CREATE TABLE IF NOT EXISTS default_replica_node (
database_name NAME NOT NULL REFERENCES node (database_name),
hypertable_name NAME NOT NULL REFERENCES hypertable (name),
hypertable_name NAME NOT NULL REFERENCES hypertable (name) ON DELETE CASCADE,
replica_id SMALLINT NOT NULL CHECK (replica_id >= 0),
PRIMARY KEY (database_name, hypertable_name),
FOREIGN KEY (hypertable_name, replica_id) REFERENCES hypertable_replica (hypertable_name, replica_id)
@ -118,7 +118,7 @@ CREATE TABLE IF NOT EXISTS distinct_replica_node (
table_name NAME NOT NULL,
PRIMARY KEY (hypertable_name, replica_id, database_name),
UNIQUE (schema_name, table_name),
FOREIGN KEY (hypertable_name, replica_id) REFERENCES hypertable_replica (hypertable_name, replica_id)
FOREIGN KEY (hypertable_name, replica_id) REFERENCES hypertable_replica (hypertable_name, replica_id) ON DELETE CASCADE
);
-- A partition_epoch represents a different partitioning of the data.
@ -133,7 +133,7 @@ CREATE TABLE IF NOT EXISTS distinct_replica_node (
-- INFREQUENTLY as it's expensive operation.
CREATE TABLE IF NOT EXISTS partition_epoch (
id SERIAL NOT NULL PRIMARY KEY,
hypertable_name NAME NOT NULL REFERENCES hypertable (name),
hypertable_name NAME NOT NULL REFERENCES hypertable (name) ON DELETE CASCADE,
start_time BIGINT NULL CHECK (start_time > 0),
end_time BIGINT NULL CHECK (end_time > 0),
partitioning_func NAME NOT NULL, --function name of a function of the form func(data_value, partitioning_mod) -> [0, partitioning_mod)
@ -150,7 +150,7 @@ CREATE TABLE IF NOT EXISTS partition_epoch (
-- keyspace, i.e. from [0, partition_epoch.partitioning_mod].
CREATE TABLE IF NOT EXISTS partition (
id SERIAL NOT NULL PRIMARY KEY,
epoch_id INT NOT NULL REFERENCES partition_epoch (id),
epoch_id INT NOT NULL REFERENCES partition_epoch (id) ON DELETE CASCADE,
keyspace_start SMALLINT NOT NULL CHECK (keyspace_start >= 0), --start inclusive
keyspace_end SMALLINT NOT NULL CHECK (keyspace_end > 0), --end inclusive; compatible with between operator
UNIQUE (epoch_id, keyspace_start),
@ -164,14 +164,14 @@ CREATE TABLE IF NOT EXISTS partition (
--TODO: trigger to verify partition_epoch hypertable name matches this hypertable_name
CREATE TABLE IF NOT EXISTS partition_replica (
id SERIAL NOT NULL PRIMARY KEY,
partition_id INT NOT NULL REFERENCES partition (id),
partition_id INT NOT NULL REFERENCES partition (id) ON DELETE CASCADE,
hypertable_name NAME NOT NULL,
replica_id SMALLINT NOT NULL,
schema_name NAME NOT NULL,
table_name NAME NOT NULL,
UNIQUE (schema_name, table_name),
UNIQUE (partition_id, replica_id),
FOREIGN KEY (hypertable_name, replica_id) REFERENCES hypertable_replica (hypertable_name, replica_id)
FOREIGN KEY (hypertable_name, replica_id) REFERENCES hypertable_replica (hypertable_name, replica_id) ON DELETE CASCADE
);
-- Represent a (replicated) chunk of data, which is data in a hypertable that is
@ -187,7 +187,7 @@ CREATE TABLE IF NOT EXISTS partition_replica (
-- TODO(erik) - Describe conditions of closure.
CREATE TABLE IF NOT EXISTS chunk (
id SERIAL NOT NULL PRIMARY KEY,
partition_id INT NOT NULL REFERENCES partition (id),
partition_id INT NOT NULL REFERENCES partition (id) ON DELETE CASCADE,
start_time BIGINT NULL CHECK (start_time >= 0),
end_time BIGINT NULL CHECK (end_time >= 0),
UNIQUE (partition_id, start_time),
@ -202,8 +202,8 @@ CREATE TABLE IF NOT EXISTS chunk (
-- Each row represents a table:
-- Parent table: "partition_replica.schema_name"."partition_replica.table_name"
CREATE TABLE IF NOT EXISTS chunk_replica_node (
chunk_id INT NOT NULL REFERENCES chunk (id),
partition_replica_id INT NOT NULL REFERENCES partition_replica (id),
chunk_id INT NOT NULL REFERENCES chunk (id) ON DELETE CASCADE,
partition_replica_id INT NOT NULL REFERENCES partition_replica (id) ON DELETE CASCADE,
database_name NAME NOT NULL REFERENCES node (database_name),
schema_name NAME NOT NULL,
table_name NAME NOT NULL,
@ -214,7 +214,7 @@ CREATE TABLE IF NOT EXISTS chunk_replica_node (
-- Represents a hypertable field.
CREATE TABLE IF NOT EXISTS field (
hypertable_name NAME NOT NULL REFERENCES hypertable (name),
hypertable_name NAME NOT NULL REFERENCES hypertable (name) ON DELETE CASCADE,
name NAME NOT NULL,
attnum INT2 NOT NULL, --MUST match pg_attribute.attnum on main table. SHOULD match on root/hierarchy table as well.
data_type REGTYPE NOT NULL,
@ -234,7 +234,7 @@ CREATE TABLE IF NOT EXISTS deleted_field (
);
CREATE TABLE IF NOT EXISTS hypertable_index (
hypertable_name NAME NOT NULL REFERENCES hypertable (name),
hypertable_name NAME NOT NULL REFERENCES hypertable (name) ON DELETE CASCADE,
main_schema_name NAME NOT NULL, --schema name of main table (needed for a uniqueness constraint)
main_index_name NAME NOT NULL, --index name on main table
definition TEXT NOT NULL, --def with /*INDEX_NAME*/ and /*TABLE_NAME*/ placeholders

View File

@ -16,7 +16,7 @@ BEGIN
EXECUTE NEW.definition;
RETURN NEW;
ELSIF TG_OP = 'DELETE' THEN
EXECUTE format('DROP INDEX %I.%I', OLD.schema_name, OLD.index_name);
EXECUTE format('DROP INDEX IF EXISTS %I.%I', OLD.schema_name, OLD.index_name);
RETURN OLD;
END IF;
END

View File

@ -8,11 +8,7 @@ DECLARE
partition_replica_row partition_replica;
chunk_row chunk;
BEGIN
IF TG_OP <> 'INSERT' THEN
RAISE EXCEPTION 'Only inserts supported on % table', TG_TABLE_NAME
USING ERRCODE = 'IO101';
END IF;
IF TG_OP = 'INSERT' THEN
SELECT *
INTO STRICT partition_replica_row
FROM partition_replica AS p
@ -41,6 +37,15 @@ BEGIN
PERFORM _sysinternal.set_time_constraint(NEW.schema_name, NEW.table_name, chunk_row.start_time, chunk_row.end_time);
RETURN NEW;
END IF;
IF TG_OP = 'DELETE' THEN
RETURN OLD;
END IF;
RAISE EXCEPTION 'Only inserts and deletes supported on % table', TG_TABLE_NAME
USING ERRCODE = 'IO101';
END
$BODY$
SET SEARCH_PATH = 'public';

View File

@ -3,8 +3,8 @@ CREATE OR REPLACE FUNCTION _sysinternal.on_create_chunk()
$BODY$
DECLARE
BEGIN
IF TG_OP <> 'INSERT' AND TG_OP <> 'UPDATE' THEN
RAISE EXCEPTION 'Only inserts and updates supported on % table', TG_TABLE_NAME
IF TG_OP <> 'INSERT' AND TG_OP <> 'UPDATE' AND TG_OP <> 'DELETE' THEN
RAISE EXCEPTION 'Only inserts, updates, and deletes supported on % table', TG_TABLE_NAME
USING ERRCODE = 'IO101';
END IF;
@ -14,6 +14,9 @@ BEGIN
WHERE crn.chunk_id = NEW.id;
END IF;
IF TG_OP = 'DELETE' THEN
RETURN OLD;
END IF;
RETURN NEW;
END
$BODY$

View File

@ -245,7 +245,6 @@ BEGIN
USING ERRCODE = 'IO101';
END LOOP;
IF NOT found_action THEN
RAISE EXCEPTION 'Unknown alter table action on %', info.objid::regclass
USING ERRCODE = 'IO101';
@ -256,3 +255,44 @@ BEGIN
$BODY$;
--Handles drop table command
CREATE OR REPLACE FUNCTION _sysinternal.ddl_process_drop_table()
RETURNS event_trigger LANGUAGE plpgsql AS $BODY$
DECLARE
obj record;
BEGIN
FOR obj IN SELECT * FROM pg_event_trigger_dropped_objects()
LOOP
IF tg_tag = 'DROP TABLE' AND obj.object_name IS NOT NULL THEN
PERFORM _sysinternal.drop_hypertable(obj.schema_name, obj.object_name);
END IF;
END LOOP;
END
$BODY$;
-- Removes a hypertable.
CREATE OR REPLACE FUNCTION _sysinternal.drop_hypertable(
schema_name TEXT,
hypertable_name TEXT
)
RETURNS void LANGUAGE PLPGSQL VOLATILE AS
$BODY$
BEGIN
PERFORM dblink_connect('meta_conn', get_meta_server_name());
PERFORM dblink_exec('meta_conn', 'BEGIN');
PERFORM 1
FROM dblink(
'meta_conn',
format('SELECT _meta.drop_hypertable(%L::text, %L::text, %L::text)',
schema_name,
hypertable_name,
current_database()
)) AS t(r TEXT);
PERFORM dblink_exec('meta_conn', 'COMMIT');
PERFORM dblink_disconnect('meta_conn');
END
$BODY$;

View File

@ -7,11 +7,7 @@ $BODY$
DECLARE
hypertable_replica_row hypertable_replica;
BEGIN
IF TG_OP <> 'INSERT' THEN
RAISE EXCEPTION 'Only inserts supported on % table', TG_TABLE_NAME
USING ERRCODE = 'IO101';
END IF;
IF TG_OP = 'INSERT' THEN
SELECT *
INTO STRICT hypertable_replica_row
FROM hypertable_replica AS h
@ -27,6 +23,15 @@ BEGIN
hypertable_replica_row.distinct_schema_name,
hypertable_replica_row.distinct_table_name, NEW.database_name);
END IF;
RETURN NEW;
END IF;
IF TG_OP = 'DELETE' THEN
RETURN OLD;
END IF;
RAISE EXCEPTION 'Only inserts and deletes supported on % table', TG_TABLE_NAME
USING ERRCODE = 'IO101';
RETURN NEW;
END

View File

@ -307,10 +307,15 @@ BEGIN
END IF;
SELECT *
INTO STRICT hypertable_row
INTO hypertable_row
FROM hypertable AS h
WHERE h.name = NEW.hypertable_name;
IF hypertable_row IS NULL THEN
--presumably hypertable has been dropped and this is part of cascade
RETURN NEW;
END IF;
-- update root table
PERFORM _sysinternal.drop_field_on_table(hypertable_row.root_schema_name, hypertable_row.root_table_name,
NEW.name);

View File

@ -4,21 +4,25 @@ $BODY$
DECLARE
hypertable_row hypertable;
BEGIN
IF TG_OP <> 'INSERT' THEN
RAISE EXCEPTION 'Only inserts supported on hypertable_replica table'
USING ERRCODE = 'IO101';
END IF;
IF TG_OP = 'INSERT' THEN
SELECT *
INTO STRICT hypertable_row
FROM hypertable AS h
WHERE h.name = NEW.hypertable_name;
PERFORM _sysinternal.create_replica_table(NEW.schema_name, NEW.table_name, hypertable_row.root_schema_name,
hypertable_row.root_table_name);
PERFORM _sysinternal.create_replica_table(NEW.distinct_schema_name, NEW.distinct_table_name,
hypertable_row.distinct_schema_name, hypertable_row.distinct_table_name);
RETURN NEW;
END IF;
IF TG_OP = 'DELETE' THEN
RETURN OLD;
END IF;
RAISE EXCEPTION 'Only inserts and deletets supported on hypertable_replica table, got %', TG_OP
USING ERRCODE = 'IO101';
RETURN NEW;
END

View File

@ -42,15 +42,13 @@ $BODY$
DECLARE
remote_node node;
BEGIN
IF TG_OP <> 'INSERT' THEN
RAISE EXCEPTION 'Only inserts supported on namespace table'
USING ERRCODE = 'IO101';
END IF;
PERFORM _sysinternal.create_schema(NEW.main_schema_name);
PERFORM _sysinternal.create_schema(NEW.associated_schema_name);
PERFORM _sysinternal.create_schema(NEW.root_schema_name);
PERFORM _sysinternal.create_schema(NEW.distinct_schema_name);
IF TG_OP = 'INSERT' THEN
EXECUTE format(
$$
CREATE SCHEMA IF NOT EXISTS %I
$$, NEW.associated_schema_name);
PERFORM _sysinternal.create_table(NEW.root_schema_name, NEW.root_table_name);
PERFORM _sysinternal.create_root_distinct_table(NEW.distinct_schema_name, NEW.distinct_table_name);
@ -71,8 +69,25 @@ BEGIN
FOR EACH STATEMENT EXECUTE PROCEDURE _sysinternal.on_modify_main_table();
$$, NEW.main_schema_name, NEW.main_table_name);
RETURN NEW;
END IF;
IF TG_OP = 'DELETE' THEN
PERFORM _sysinternal.drop_root_table(OLD.root_schema_name, OLD.root_table_name);
PERFORM _sysinternal.drop_root_distinct_table(OLD.distinct_schema_name, OLD.distinct_table_name);
if current_setting('io.iobeam_drop', true) <> 'true' THEN
PERFORM set_config('io.iobeam_drop', 'true', true);
PERFORM _sysinternal.drop_table(OLD.main_schema_name, OLD.main_table_name);
END IF;
RETURN OLD;
END IF;
RAISE EXCEPTION 'Only inserts and delete supported on hypertable metadata table'
USING ERRCODE = 'IO101';
END
$BODY$
SET SEARCH_PATH = 'public';

View File

@ -2,11 +2,7 @@ CREATE OR REPLACE FUNCTION _sysinternal.on_create_partition_replica_table()
RETURNS TRIGGER LANGUAGE PLPGSQL AS
$BODY$
BEGIN
IF TG_OP <> 'INSERT' THEN
RAISE EXCEPTION 'Only inserts supported on % table', TG_TABLE_NAME
USING ERRCODE = 'IO101';
END IF;
IF TG_OP = 'INSERT' THEN
PERFORM _sysinternal.create_data_partition_table(
NEW.schema_name, NEW.table_name,
hr.schema_name, hr.table_name,
@ -19,6 +15,15 @@ BEGIN
p.id = NEW.partition_id;
RETURN NEW;
END IF;
IF TG_OP = 'DELETE' THEN
RETURN OLD;
END IF;
RAISE EXCEPTION 'Only inserts and deletes supported on % table', TG_TABLE_NAME
USING ERRCODE = 'IO101';
END
$BODY$
SET SEARCH_PATH = 'public';

View File

@ -91,5 +91,9 @@ BEGIN
WHEN tag IN ('alter table')
EXECUTE PROCEDURE _sysinternal.ddl_process_alter_table();
CREATE EVENT TRIGGER ddl_check_drop_command
ON sql_drop
EXECUTE PROCEDURE _sysinternal.ddl_process_drop_table();
END
$BODY$;

View File

@ -31,6 +31,36 @@ BEGIN
END
$BODY$;
-- Drop main table if it exists.
CREATE OR REPLACE FUNCTION _sysinternal.drop_main_table(
schema_name NAME,
table_name NAME
)
RETURNS VOID LANGUAGE PLPGSQL VOLATILE AS
$BODY$
BEGIN
EXECUTE format(
$$
DROP TABLE IF EXISTS %I.%I;
$$, schema_name, table_name);
END
$BODY$;
-- Drops root table
CREATE OR REPLACE FUNCTION _sysinternal.drop_root_table(
schema_name NAME,
table_name NAME
)
RETURNS VOID LANGUAGE PLPGSQL VOLATILE AS
$BODY$
BEGIN
EXECUTE format(
$$
DROP TABLE %I.%I CASCADE;
$$, schema_name, table_name);
END
$BODY$;
-- Creates a root distinct table for a hypertable.
CREATE OR REPLACE FUNCTION _sysinternal.create_root_distinct_table(
schema_name NAME,
@ -50,6 +80,22 @@ BEGIN
END
$BODY$;
-- Drops root distinct table
CREATE OR REPLACE FUNCTION _sysinternal.drop_root_distinct_table(
schema_name NAME,
table_name NAME
)
RETURNS VOID LANGUAGE PLPGSQL VOLATILE AS
$BODY$
BEGIN
EXECUTE format(
$$
DROP TABLE %1$I.%2$I CASCADE;
$$, schema_name, table_name);
END
$BODY$;
CREATE OR REPLACE FUNCTION _sysinternal.create_local_distinct_table(
schema_name NAME,
table_name NAME,

View File

@ -12,5 +12,5 @@ CREATE TABLE IF NOT EXISTS chunk_replica_node_index (
definition TEXT NOT NULL,
PRIMARY KEY (schema_name, table_name, index_name),
FOREIGN KEY (schema_name, table_name) REFERENCES chunk_replica_node (schema_name, table_name),
FOREIGN KEY (main_schema_name, main_index_name) REFERENCES hypertable_index (main_schema_name, main_index_name)
FOREIGN KEY (main_schema_name, main_index_name) REFERENCES hypertable_index (main_schema_name, main_index_name) ON DELETE CASCADE
);

View File

@ -3,11 +3,7 @@ CREATE OR REPLACE FUNCTION _meta.on_create_chunk_replica_node_meta()
$BODY$
DECLARE
BEGIN
IF TG_OP <> 'INSERT' THEN
RAISE EXCEPTION 'Only inserts supported on % table', TG_TABLE_NAME
USING ERRCODE = 'IO101';
END IF;
IF TG_OP = 'INSERT' THEN
INSERT INTO distinct_replica_node (hypertable_name, replica_id, database_name, schema_name, table_name)
SELECT
pr.hypertable_name,
@ -22,6 +18,15 @@ BEGIN
ON CONFLICT DO NOTHING;
RETURN NEW;
END IF;
IF TG_OP = 'DELETE' THEN
RETURN OLD;
END IF;
RAISE EXCEPTION 'Only inserts and deletes supported on % table', TG_TABLE_NAME
USING ERRCODE = 'IO101';
END
$BODY$
SET SEARCH_PATH = 'public';

View File

@ -47,6 +47,10 @@ DECLARE
field_row field;
schema_name NAME;
BEGIN
IF TG_OP = 'DELETE' THEN
RETURN OLD;
END IF;
IF TG_OP = 'UPDATE' THEN
IF (
(OLD.start_time IS NULL AND new.start_time IS NOT NULL)

View File

@ -26,7 +26,7 @@ BEGIN
id := nextval('default_hypertable_seq');
IF associated_schema_name IS NULL THEN
associated_schema_name = format('_sys_%s_%s', id, hypertable_name);
associated_schema_name = '_sysinternal';
END IF;
IF associated_table_prefix IS NULL THEN
@ -191,3 +191,15 @@ SELECT set_config('io.deleting_node', modified_on, true);
DELETE FROM hypertable_index i
WHERE i.main_index_name = drop_index.main_index_name AND i.main_schema_name = drop_index.main_schema_name;
$BODY$;
-- Drops a hypertable
CREATE OR REPLACE FUNCTION _meta.drop_hypertable(
schema_name NAME,
hypertable_name NAME,
modified_on NAME
)
RETURNS VOID LANGUAGE SQL VOLATILE AS
$BODY$
SELECT set_config('io.deleting_node', modified_on, true);
DELETE FROM hypertable h WHERE h.main_schema_name = schema_name AND h.main_table_name = hypertable_name
$BODY$;

View File

@ -3,11 +3,7 @@ CREATE OR REPLACE FUNCTION _meta.on_create_hypertable()
RETURNS TRIGGER LANGUAGE PLPGSQL AS
$BODY$
BEGIN
IF TG_OP <> 'INSERT' THEN
RAISE EXCEPTION 'Only inserts supported on hypertable name '
USING ERRCODE = 'IO101';
END IF;
IF TG_OP = 'INSERT' THEN
INSERT INTO hypertable_replica
SELECT
NEW.name,
@ -21,6 +17,15 @@ BEGIN
PERFORM _meta.assign_default_replica_node(n.database_name, NEW.name)
FROM node n;
RETURN NEW;
END IF;
IF TG_OP = 'DELETE' THEN
RETURN OLD;
END IF;
RAISE EXCEPTION 'Only inserts and deletes supported on hypertable name '
USING ERRCODE = 'IO101';
RETURN NEW;
END

View File

@ -2,10 +2,7 @@ CREATE OR REPLACE FUNCTION _meta.on_create_partition()
RETURNS TRIGGER LANGUAGE PLPGSQL AS
$BODY$
BEGIN
IF TG_OP <> 'INSERT' THEN
RAISE EXCEPTION 'Only inserts supported on % name ', TG_TABLE_NAME
USING ERRCODE = 'IO101';
END IF;
IF TG_OP = 'INSERT' THEN
INSERT INTO partition_replica (partition_id, hypertable_name, replica_id, schema_name, table_name)
SELECT
@ -23,7 +20,14 @@ BEGIN
);
RETURN NEW;
END IF;
IF TG_OP = 'DELETE' THEN
RETURN OLD;
END IF;
RAISE EXCEPTION 'Only inserts and deletes supported on % name ', TG_TABLE_NAME
USING ERRCODE = 'IO101';
END
$BODY$;

View File

@ -92,8 +92,7 @@ FROM field;
\des+
\deu+
\d+ "_sys_1_testNs".*
\d+ "_sysinternal".*
--\d+ "_sys_1_testNs"."_sys_1_testNs_1_0_partition"
--\d+ "_sys_1_testNs"."_sys_1_testNs_2_0_partition"
@ -105,7 +104,7 @@ FROM field;
SELECT *
FROM _meta.get_or_create_chunk(1, 1257894000000000000 :: BIGINT);
\c Test1
\d+ "_sys_1_testNs".*
\d+ "_sysinternal".*
\c meta
SELECT _meta.close_chunk_end(1);
@ -120,6 +119,6 @@ SELECT *
FROM chunk;
\c Test1
\d+ "_sys_1_testNs".*
\d+ "_sysinternal".*

View File

@ -51,15 +51,15 @@ SELECT * FROM ONLY PUBLIC."Hypertable_1";
EXPLAIN SELECT * FROM ONLY PUBLIC."Hypertable_1";
\d+ PUBLIC."Hypertable_1"
\d+ "_sys_1_"."_hyper_1_root"
\d+ _sys_1_._hyper_1_1_0_1_data
\d+ "_sysinternal"."_hyper_1_root"
\d+ _sysinternal._hyper_1_1_0_1_data
SELECT * FROM PUBLIC.default_replica_node;
\c test2
\d+ PUBLIC."Hypertable_1"
\d+ "_sys_1_"."_hyper_1_root"
\d+ "_sysinternal"."_hyper_1_root"
SELECT set_is_distinct_flag('"public"."Hypertable_1"', 'sensor_2', FALSE);
SELECT set_is_distinct_flag('"public"."Hypertable_1"', 'Device_id', TRUE);
@ -88,13 +88,13 @@ ALTER TABLE PUBLIC."Hypertable_1" ADD COLUMN sensor_4 BIGINT NOT NULL DEFAULT 13
\d+ PUBLIC."Hypertable_1"
\d+ "_sys_1_"."_hyper_1_root"
SELECT * FROM _sys_1_._hyper_1_0_1_distinct_data;
\d+ "_sysinternal"."_hyper_1_root"
SELECT * FROM _sysinternal._hyper_1_0_1_distinct_data;
\c Test1
\d+ PUBLIC."Hypertable_1"
\d+ "_sys_1_"."_hyper_1_root"
\d+ _sys_1_._hyper_1_1_0_1_data
\d+ "_sysinternal"."_hyper_1_root"
\d+ _sysinternal._hyper_1_1_0_1_data
SELECT * FROM PUBLIC."Hypertable_1";

View File

@ -0,0 +1,23 @@
\set ON_ERROR_STOP 1
\o /dev/null
\ir include/insert.sql
\o
\set ECHO ALL
\c Test1
\d+ "_sysinternal".*
\c test2
SELECT *
FROM "_sysinternal"._hyper_1_0_replica;
SELECT *
FROM "_sysinternal"._hyper_1_0_distinct;
SELECT * FROM hypertable;
DROP TABLE "testNs";
SELECT * FROM hypertable;
\dt+ "_sysinternal".*
\c Test1
\dt+ "_sysinternal".*

View File

@ -54,7 +54,7 @@ CREATE INDEX ON PUBLIC."testNs" (time DESC NULLS LAST, really_long_field_goes_on
SELECT * FROM create_hypertable('"public"."testNs"', 'time', 'Device_id', hypertable_name=>'testNs');
name | main_schema_name | main_table_name | associated_schema_name | associated_table_prefix | root_schema_name | root_table_name | distinct_schema_name | distinct_table_name | replication_factor | placement | time_field_name | time_field_type | created_on | chunk_size_bytes
--------+------------------+-----------------+------------------------+-------------------------+------------------+-----------------+----------------------+---------------------+--------------------+-----------+-----------------+-----------------+------------+------------------
testNs | public | testNs | _sys_1_testNs | _hyper_1 | _sys_1_testNs | _hyper_1_root | _sys_1_testNs | _hyper_1_distinct | 1 | STICKY | time | bigint | Test1 | 1073741824
testNs | public | testNs | _sysinternal | _hyper_1 | _sysinternal | _hyper_1_root | _sysinternal | _hyper_1_distinct | 1 | STICKY | time | bigint | Test1 | 1073741824
(1 row)
SELECT set_is_distinct_flag('"public"."testNs"', 'Device_id', TRUE);
@ -67,9 +67,9 @@ SELECT set_is_distinct_flag('"public"."testNs"', 'Device_id', TRUE);
SELECT *
FROM partition_replica;
id | partition_id | hypertable_name | replica_id | schema_name | table_name
----+--------------+-----------------+------------+---------------+------------------------
1 | 1 | testNs | 0 | _sys_1_testNs | _hyper_1_1_0_partition
2 | 2 | testNs | 0 | _sys_1_testNs | _hyper_1_2_0_partition
----+--------------+-----------------+------------+--------------+------------------------
1 | 1 | testNs | 0 | _sysinternal | _hyper_1_1_0_partition
2 | 2 | testNs | 0 | _sysinternal | _hyper_1_2_0_partition
(2 rows)
SELECT *
@ -98,21 +98,21 @@ SELECT *
FROM hypertable;
name | main_schema_name | main_table_name | associated_schema_name | associated_table_prefix | root_schema_name | root_table_name | distinct_schema_name | distinct_table_name | replication_factor | placement | time_field_name | time_field_type | created_on | chunk_size_bytes
--------+------------------+-----------------+------------------------+-------------------------+------------------+-----------------+----------------------+---------------------+--------------------+-----------+-----------------+-----------------+------------+------------------
testNs | public | testNs | _sys_1_testNs | _hyper_1 | _sys_1_testNs | _hyper_1_root | _sys_1_testNs | _hyper_1_distinct | 1 | STICKY | time | bigint | Test1 | 1073741824
testNs | public | testNs | _sysinternal | _hyper_1 | _sysinternal | _hyper_1_root | _sysinternal | _hyper_1_distinct | 1 | STICKY | time | bigint | Test1 | 1073741824
(1 row)
SELECT *
FROM hypertable_replica;
hypertable_name | replica_id | schema_name | table_name | distinct_schema_name | distinct_table_name
-----------------+------------+---------------+--------------------+----------------------+---------------------
testNs | 0 | _sys_1_testNs | _hyper_1_0_replica | _sys_1_testNs | _hyper_1_0_distinct
-----------------+------------+--------------+--------------------+----------------------+---------------------
testNs | 0 | _sysinternal | _hyper_1_0_replica | _sysinternal | _hyper_1_0_distinct
(1 row)
SELECT *
FROM distinct_replica_node;
hypertable_name | replica_id | database_name | schema_name | table_name
-----------------+------------+---------------+---------------+----------------------------
testNs | 0 | Test1 | _sys_1_testNs | _hyper_1_0_1_distinct_data
-----------------+------------+---------------+--------------+----------------------------
testNs | 0 | Test1 | _sysinternal | _hyper_1_0_1_distinct_data
(1 row)
SELECT *
@ -133,9 +133,9 @@ FROM partition;
SELECT *
FROM partition_replica;
id | partition_id | hypertable_name | replica_id | schema_name | table_name
----+--------------+-----------------+------------+---------------+------------------------
1 | 1 | testNs | 0 | _sys_1_testNs | _hyper_1_1_0_partition
2 | 2 | testNs | 0 | _sys_1_testNs | _hyper_1_2_0_partition
----+--------------+-----------------+------------+--------------+------------------------
1 | 1 | testNs | 0 | _sysinternal | _hyper_1_1_0_partition
2 | 2 | testNs | 0 | _sysinternal | _hyper_1_2_0_partition
(2 rows)
SELECT *
@ -148,8 +148,8 @@ FROM chunk;
SELECT *
FROM chunk_replica_node;
chunk_id | partition_replica_id | database_name | schema_name | table_name
----------+----------------------+---------------+---------------+---------------------
1 | 1 | Test1 | _sys_1_testNs | _hyper_1_1_0_1_data
----------+----------------------+---------------+--------------+---------------------
1 | 1 | Test1 | _sysinternal | _hyper_1_1_0_1_data
(1 row)
SELECT *
@ -202,21 +202,21 @@ SELECT *
FROM hypertable;
name | main_schema_name | main_table_name | associated_schema_name | associated_table_prefix | root_schema_name | root_table_name | distinct_schema_name | distinct_table_name | replication_factor | placement | time_field_name | time_field_type | created_on | chunk_size_bytes
--------+------------------+-----------------+------------------------+-------------------------+------------------+-----------------+----------------------+---------------------+--------------------+-----------+-----------------+-----------------+------------+------------------
testNs | public | testNs | _sys_1_testNs | _hyper_1 | _sys_1_testNs | _hyper_1_root | _sys_1_testNs | _hyper_1_distinct | 1 | STICKY | time | bigint | Test1 | 1073741824
testNs | public | testNs | _sysinternal | _hyper_1 | _sysinternal | _hyper_1_root | _sysinternal | _hyper_1_distinct | 1 | STICKY | time | bigint | Test1 | 1073741824
(1 row)
SELECT *
FROM hypertable_replica;
hypertable_name | replica_id | schema_name | table_name | distinct_schema_name | distinct_table_name
-----------------+------------+---------------+--------------------+----------------------+---------------------
testNs | 0 | _sys_1_testNs | _hyper_1_0_replica | _sys_1_testNs | _hyper_1_0_distinct
-----------------+------------+--------------+--------------------+----------------------+---------------------
testNs | 0 | _sysinternal | _hyper_1_0_replica | _sysinternal | _hyper_1_0_distinct
(1 row)
SELECT *
FROM distinct_replica_node;
hypertable_name | replica_id | database_name | schema_name | table_name
-----------------+------------+---------------+---------------+----------------------------
testNs | 0 | Test1 | _sys_1_testNs | _hyper_1_0_1_distinct_data
-----------------+------------+---------------+--------------+----------------------------
testNs | 0 | Test1 | _sysinternal | _hyper_1_0_1_distinct_data
(1 row)
SELECT *
@ -237,9 +237,9 @@ FROM partition;
SELECT *
FROM partition_replica;
id | partition_id | hypertable_name | replica_id | schema_name | table_name
----+--------------+-----------------+------------+---------------+------------------------
1 | 1 | testNs | 0 | _sys_1_testNs | _hyper_1_1_0_partition
2 | 2 | testNs | 0 | _sys_1_testNs | _hyper_1_2_0_partition
----+--------------+-----------------+------------+--------------+------------------------
1 | 1 | testNs | 0 | _sysinternal | _hyper_1_1_0_partition
2 | 2 | testNs | 0 | _sysinternal | _hyper_1_2_0_partition
(2 rows)
SELECT *
@ -252,8 +252,8 @@ FROM chunk;
SELECT *
FROM chunk_replica_node;
chunk_id | partition_replica_id | database_name | schema_name | table_name
----------+----------------------+---------------+---------------+---------------------
1 | 1 | Test1 | _sys_1_testNs | _hyper_1_1_0_1_data
----------+----------------------+---------------+--------------+---------------------
1 | 1 | Test1 | _sysinternal | _hyper_1_1_0_1_data
(1 row)
SELECT *
@ -284,60 +284,60 @@ FROM field;
test2 | postgres | ("user" 'postgres', password '')
(2 rows)
\d+ "_sys_1_testNs".*
Index "_sys_1_testNs.1-testNs_Device_id_time_idx"
\d+ "_sysinternal".*
Index "_sysinternal.1-testNs_Device_id_time_idx"
Column | Type | Definition | Storage
-----------+--------+-------------+----------
Device_id | text | "Device_id" | extended
time | bigint | "time" | plain
btree, for table "_sys_1_testNs._hyper_1_1_0_1_data", predicate ("Device_id" IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate ("Device_id" IS NOT NULL)
Index "_sys_1_testNs.2-testNs_really_long_field_goes_on_and_on_and_on_and_on_and_o_i"
Index "_sysinternal.2-testNs_really_long_field_goes_on_and_on_and_on_and_on_and_o_i"
Column | Type | Definition | Storage
-----------------------------------------------------------------+--------+-----------------------------------------------------------------+---------
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | plain
time | bigint | "time" | plain
btree, for table "_sys_1_testNs._hyper_1_1_0_1_data", predicate (really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an IS NOT NULL)
Index "_sys_1_testNs.3-testNs_temp_time_idx"
Index "_sysinternal.3-testNs_temp_time_idx"
Column | Type | Definition | Storage
--------+------------------+------------+---------
temp | double precision | temp | plain
time | bigint | "time" | plain
btree, for table "_sys_1_testNs._hyper_1_1_0_1_data", predicate (temp IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (temp IS NOT NULL)
Index "_sys_1_testNs.4-testNs_time_really_long_field_goes_on_and_on_and_on_and_on__i"
Index "_sysinternal.4-testNs_time_really_long_field_goes_on_and_on_and_on_and_on__i"
Column | Type | Definition | Storage
-----------------------------------------------------------------+--------+-----------------------------------------------------------------+---------
time | bigint | "time" | plain
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | plain
btree, for table "_sys_1_testNs._hyper_1_1_0_1_data", predicate (really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an IS NOT NULL)
Table "_sys_1_testNs._hyper_1_0_1_distinct_data"
Table "_sysinternal._hyper_1_0_1_distinct_data"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_1_0_1_distinct_data_pkey" PRIMARY KEY, btree (field, value)
Inherits: "_sys_1_testNs"._hyper_1_0_distinct
Inherits: _sysinternal._hyper_1_0_distinct
Index "_sys_1_testNs._hyper_1_0_1_distinct_data_pkey"
Index "_sysinternal._hyper_1_0_1_distinct_data_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "_sys_1_testNs._hyper_1_0_1_distinct_data"
primary key, btree, for table "_sysinternal._hyper_1_0_1_distinct_data"
Table "_sys_1_testNs._hyper_1_0_distinct"
Table "_sysinternal._hyper_1_0_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Inherits: "_sys_1_testNs"._hyper_1_distinct
Child tables: "_sys_1_testNs"._hyper_1_0_1_distinct_data
Inherits: _sysinternal._hyper_1_distinct
Child tables: _sysinternal._hyper_1_0_1_distinct_data
Table "_sys_1_testNs._hyper_1_0_replica"
Table "_sysinternal._hyper_1_0_replica"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -346,11 +346,11 @@ Child tables: "_sys_1_testNs"._hyper_1_0_1_distinct_data
occupied | boolean | | plain | |
latitude | bigint | | plain | |
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | | plain | |
Inherits: "_sys_1_testNs"._hyper_1_root
Child tables: "_sys_1_testNs"._hyper_1_1_0_partition,
"_sys_1_testNs"._hyper_1_2_0_partition
Inherits: _sysinternal._hyper_1_root
Child tables: _sysinternal._hyper_1_1_0_partition,
_sysinternal._hyper_1_2_0_partition
Table "_sys_1_testNs._hyper_1_1_0_1_data"
Table "_sysinternal._hyper_1_1_0_1_data"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -366,9 +366,9 @@ Indexes:
"4-testNs_time_really_long_field_goes_on_and_on_and_on_and_on__i" btree ("time" DESC NULLS LAST, really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an) WHERE really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an IS NOT NULL
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Inherits: "_sys_1_testNs"._hyper_1_1_0_partition
Inherits: _sysinternal._hyper_1_1_0_partition
Table "_sys_1_testNs._hyper_1_1_0_partition"
Table "_sysinternal._hyper_1_1_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -379,10 +379,10 @@ Inherits: "_sys_1_testNs"._hyper_1_1_0_partition
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Inherits: "_sys_1_testNs"._hyper_1_0_replica
Child tables: "_sys_1_testNs"._hyper_1_1_0_1_data
Inherits: _sysinternal._hyper_1_0_replica
Child tables: _sysinternal._hyper_1_1_0_1_data
Table "_sys_1_testNs._hyper_1_2_0_partition"
Table "_sysinternal._hyper_1_2_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -393,25 +393,25 @@ Child tables: "_sys_1_testNs"._hyper_1_1_0_1_data
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '16384'::smallint AND get_partition_for_key("Device_id", 32768) <= '32767'::smallint)
Inherits: "_sys_1_testNs"._hyper_1_0_replica
Inherits: _sysinternal._hyper_1_0_replica
Table "_sys_1_testNs._hyper_1_distinct"
Table "_sysinternal._hyper_1_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_1_distinct_pkey" PRIMARY KEY, btree (field, value)
Child tables: "_sys_1_testNs"._hyper_1_0_distinct
Child tables: _sysinternal._hyper_1_0_distinct
Index "_sys_1_testNs._hyper_1_distinct_pkey"
Index "_sysinternal._hyper_1_distinct_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "_sys_1_testNs._hyper_1_distinct"
primary key, btree, for table "_sysinternal._hyper_1_distinct"
Table "_sys_1_testNs._hyper_1_root"
Table "_sysinternal._hyper_1_root"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -420,7 +420,7 @@ primary key, btree, for table "_sys_1_testNs._hyper_1_distinct"
occupied | boolean | | plain | |
latitude | bigint | | plain | |
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | | plain | |
Child tables: "_sys_1_testNs"._hyper_1_0_replica
Child tables: _sysinternal._hyper_1_0_replica
--\d+ "_sys_1_testNs"."_sys_1_testNs_1_0_partition"
--\d+ "_sys_1_testNs"."_sys_1_testNs_2_0_partition"
@ -436,60 +436,60 @@ FROM _meta.get_or_create_chunk(1, 1257894000000000000 :: BIGINT);
(1 row)
\c Test1
\d+ "_sys_1_testNs".*
Index "_sys_1_testNs.1-testNs_Device_id_time_idx"
\d+ "_sysinternal".*
Index "_sysinternal.1-testNs_Device_id_time_idx"
Column | Type | Definition | Storage
-----------+--------+-------------+----------
Device_id | text | "Device_id" | extended
time | bigint | "time" | plain
btree, for table "_sys_1_testNs._hyper_1_1_0_1_data", predicate ("Device_id" IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate ("Device_id" IS NOT NULL)
Index "_sys_1_testNs.2-testNs_really_long_field_goes_on_and_on_and_on_and_on_and_o_i"
Index "_sysinternal.2-testNs_really_long_field_goes_on_and_on_and_on_and_on_and_o_i"
Column | Type | Definition | Storage
-----------------------------------------------------------------+--------+-----------------------------------------------------------------+---------
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | plain
time | bigint | "time" | plain
btree, for table "_sys_1_testNs._hyper_1_1_0_1_data", predicate (really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an IS NOT NULL)
Index "_sys_1_testNs.3-testNs_temp_time_idx"
Index "_sysinternal.3-testNs_temp_time_idx"
Column | Type | Definition | Storage
--------+------------------+------------+---------
temp | double precision | temp | plain
time | bigint | "time" | plain
btree, for table "_sys_1_testNs._hyper_1_1_0_1_data", predicate (temp IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (temp IS NOT NULL)
Index "_sys_1_testNs.4-testNs_time_really_long_field_goes_on_and_on_and_on_and_on__i"
Index "_sysinternal.4-testNs_time_really_long_field_goes_on_and_on_and_on_and_on__i"
Column | Type | Definition | Storage
-----------------------------------------------------------------+--------+-----------------------------------------------------------------+---------
time | bigint | "time" | plain
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | plain
btree, for table "_sys_1_testNs._hyper_1_1_0_1_data", predicate (really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an IS NOT NULL)
Table "_sys_1_testNs._hyper_1_0_1_distinct_data"
Table "_sysinternal._hyper_1_0_1_distinct_data"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_1_0_1_distinct_data_pkey" PRIMARY KEY, btree (field, value)
Inherits: "_sys_1_testNs"._hyper_1_0_distinct
Inherits: _sysinternal._hyper_1_0_distinct
Index "_sys_1_testNs._hyper_1_0_1_distinct_data_pkey"
Index "_sysinternal._hyper_1_0_1_distinct_data_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "_sys_1_testNs._hyper_1_0_1_distinct_data"
primary key, btree, for table "_sysinternal._hyper_1_0_1_distinct_data"
Table "_sys_1_testNs._hyper_1_0_distinct"
Table "_sysinternal._hyper_1_0_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Inherits: "_sys_1_testNs"._hyper_1_distinct
Child tables: "_sys_1_testNs"._hyper_1_0_1_distinct_data
Inherits: _sysinternal._hyper_1_distinct
Child tables: _sysinternal._hyper_1_0_1_distinct_data
Table "_sys_1_testNs._hyper_1_0_replica"
Table "_sysinternal._hyper_1_0_replica"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -498,11 +498,11 @@ Child tables: "_sys_1_testNs"._hyper_1_0_1_distinct_data
occupied | boolean | | plain | |
latitude | bigint | | plain | |
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | | plain | |
Inherits: "_sys_1_testNs"._hyper_1_root
Child tables: "_sys_1_testNs"._hyper_1_1_0_partition,
"_sys_1_testNs"._hyper_1_2_0_partition
Inherits: _sysinternal._hyper_1_root
Child tables: _sysinternal._hyper_1_1_0_partition,
_sysinternal._hyper_1_2_0_partition
Table "_sys_1_testNs._hyper_1_1_0_1_data"
Table "_sysinternal._hyper_1_1_0_1_data"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -518,9 +518,9 @@ Indexes:
"4-testNs_time_really_long_field_goes_on_and_on_and_on_and_on__i" btree ("time" DESC NULLS LAST, really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an) WHERE really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an IS NOT NULL
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Inherits: "_sys_1_testNs"._hyper_1_1_0_partition
Inherits: _sysinternal._hyper_1_1_0_partition
Table "_sys_1_testNs._hyper_1_1_0_partition"
Table "_sysinternal._hyper_1_1_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -531,10 +531,10 @@ Inherits: "_sys_1_testNs"._hyper_1_1_0_partition
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Inherits: "_sys_1_testNs"._hyper_1_0_replica
Child tables: "_sys_1_testNs"._hyper_1_1_0_1_data
Inherits: _sysinternal._hyper_1_0_replica
Child tables: _sysinternal._hyper_1_1_0_1_data
Table "_sys_1_testNs._hyper_1_2_0_partition"
Table "_sysinternal._hyper_1_2_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -545,25 +545,25 @@ Child tables: "_sys_1_testNs"._hyper_1_1_0_1_data
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '16384'::smallint AND get_partition_for_key("Device_id", 32768) <= '32767'::smallint)
Inherits: "_sys_1_testNs"._hyper_1_0_replica
Inherits: _sysinternal._hyper_1_0_replica
Table "_sys_1_testNs._hyper_1_distinct"
Table "_sysinternal._hyper_1_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_1_distinct_pkey" PRIMARY KEY, btree (field, value)
Child tables: "_sys_1_testNs"._hyper_1_0_distinct
Child tables: _sysinternal._hyper_1_0_distinct
Index "_sys_1_testNs._hyper_1_distinct_pkey"
Index "_sysinternal._hyper_1_distinct_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "_sys_1_testNs._hyper_1_distinct"
primary key, btree, for table "_sysinternal._hyper_1_distinct"
Table "_sys_1_testNs._hyper_1_root"
Table "_sysinternal._hyper_1_root"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -572,7 +572,7 @@ primary key, btree, for table "_sys_1_testNs._hyper_1_distinct"
occupied | boolean | | plain | |
latitude | bigint | | plain | |
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | | plain | |
Child tables: "_sys_1_testNs"._hyper_1_0_replica
Child tables: _sysinternal._hyper_1_0_replica
\c meta
SELECT _meta.close_chunk_end(1);
@ -610,60 +610,60 @@ FROM chunk;
(1 row)
\c Test1
\d+ "_sys_1_testNs".*
Index "_sys_1_testNs.1-testNs_Device_id_time_idx"
\d+ "_sysinternal".*
Index "_sysinternal.1-testNs_Device_id_time_idx"
Column | Type | Definition | Storage
-----------+--------+-------------+----------
Device_id | text | "Device_id" | extended
time | bigint | "time" | plain
btree, for table "_sys_1_testNs._hyper_1_1_0_1_data", predicate ("Device_id" IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate ("Device_id" IS NOT NULL)
Index "_sys_1_testNs.2-testNs_really_long_field_goes_on_and_on_and_on_and_on_and_o_i"
Index "_sysinternal.2-testNs_really_long_field_goes_on_and_on_and_on_and_on_and_o_i"
Column | Type | Definition | Storage
-----------------------------------------------------------------+--------+-----------------------------------------------------------------+---------
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | plain
time | bigint | "time" | plain
btree, for table "_sys_1_testNs._hyper_1_1_0_1_data", predicate (really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an IS NOT NULL)
Index "_sys_1_testNs.3-testNs_temp_time_idx"
Index "_sysinternal.3-testNs_temp_time_idx"
Column | Type | Definition | Storage
--------+------------------+------------+---------
temp | double precision | temp | plain
time | bigint | "time" | plain
btree, for table "_sys_1_testNs._hyper_1_1_0_1_data", predicate (temp IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (temp IS NOT NULL)
Index "_sys_1_testNs.4-testNs_time_really_long_field_goes_on_and_on_and_on_and_on__i"
Index "_sysinternal.4-testNs_time_really_long_field_goes_on_and_on_and_on_and_on__i"
Column | Type | Definition | Storage
-----------------------------------------------------------------+--------+-----------------------------------------------------------------+---------
time | bigint | "time" | plain
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | plain
btree, for table "_sys_1_testNs._hyper_1_1_0_1_data", predicate (really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an IS NOT NULL)
Table "_sys_1_testNs._hyper_1_0_1_distinct_data"
Table "_sysinternal._hyper_1_0_1_distinct_data"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_1_0_1_distinct_data_pkey" PRIMARY KEY, btree (field, value)
Inherits: "_sys_1_testNs"._hyper_1_0_distinct
Inherits: _sysinternal._hyper_1_0_distinct
Index "_sys_1_testNs._hyper_1_0_1_distinct_data_pkey"
Index "_sysinternal._hyper_1_0_1_distinct_data_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "_sys_1_testNs._hyper_1_0_1_distinct_data"
primary key, btree, for table "_sysinternal._hyper_1_0_1_distinct_data"
Table "_sys_1_testNs._hyper_1_0_distinct"
Table "_sysinternal._hyper_1_0_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Inherits: "_sys_1_testNs"._hyper_1_distinct
Child tables: "_sys_1_testNs"._hyper_1_0_1_distinct_data
Inherits: _sysinternal._hyper_1_distinct
Child tables: _sysinternal._hyper_1_0_1_distinct_data
Table "_sys_1_testNs._hyper_1_0_replica"
Table "_sysinternal._hyper_1_0_replica"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -672,11 +672,11 @@ Child tables: "_sys_1_testNs"._hyper_1_0_1_distinct_data
occupied | boolean | | plain | |
latitude | bigint | | plain | |
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | | plain | |
Inherits: "_sys_1_testNs"._hyper_1_root
Child tables: "_sys_1_testNs"._hyper_1_1_0_partition,
"_sys_1_testNs"._hyper_1_2_0_partition
Inherits: _sysinternal._hyper_1_root
Child tables: _sysinternal._hyper_1_1_0_partition,
_sysinternal._hyper_1_2_0_partition
Table "_sys_1_testNs._hyper_1_1_0_1_data"
Table "_sysinternal._hyper_1_1_0_1_data"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -692,9 +692,9 @@ Indexes:
"4-testNs_time_really_long_field_goes_on_and_on_and_on_and_on__i" btree ("time" DESC NULLS LAST, really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an) WHERE really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an IS NOT NULL
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Inherits: "_sys_1_testNs"._hyper_1_1_0_partition
Inherits: _sysinternal._hyper_1_1_0_partition
Table "_sys_1_testNs._hyper_1_1_0_partition"
Table "_sysinternal._hyper_1_1_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -705,10 +705,10 @@ Inherits: "_sys_1_testNs"._hyper_1_1_0_partition
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Inherits: "_sys_1_testNs"._hyper_1_0_replica
Child tables: "_sys_1_testNs"._hyper_1_1_0_1_data
Inherits: _sysinternal._hyper_1_0_replica
Child tables: _sysinternal._hyper_1_1_0_1_data
Table "_sys_1_testNs._hyper_1_2_0_partition"
Table "_sysinternal._hyper_1_2_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -719,25 +719,25 @@ Child tables: "_sys_1_testNs"._hyper_1_1_0_1_data
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '16384'::smallint AND get_partition_for_key("Device_id", 32768) <= '32767'::smallint)
Inherits: "_sys_1_testNs"._hyper_1_0_replica
Inherits: _sysinternal._hyper_1_0_replica
Table "_sys_1_testNs._hyper_1_distinct"
Table "_sysinternal._hyper_1_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_1_distinct_pkey" PRIMARY KEY, btree (field, value)
Child tables: "_sys_1_testNs"._hyper_1_0_distinct
Child tables: _sysinternal._hyper_1_0_distinct
Index "_sys_1_testNs._hyper_1_distinct_pkey"
Index "_sysinternal._hyper_1_distinct_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "_sys_1_testNs._hyper_1_distinct"
primary key, btree, for table "_sysinternal._hyper_1_distinct"
Table "_sys_1_testNs._hyper_1_root"
Table "_sysinternal._hyper_1_root"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -746,5 +746,5 @@ primary key, btree, for table "_sys_1_testNs._hyper_1_distinct"
occupied | boolean | | plain | |
latitude | bigint | | plain | |
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | | plain | |
Child tables: "_sys_1_testNs"._hyper_1_0_replica
Child tables: _sysinternal._hyper_1_0_replica

View File

@ -38,13 +38,13 @@ CREATE INDEX ON PUBLIC."Hypertable_1" (time, "Device_id");
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time', 'Device_id');
name | main_schema_name | main_table_name | associated_schema_name | associated_table_prefix | root_schema_name | root_table_name | distinct_schema_name | distinct_table_name | replication_factor | placement | time_field_name | time_field_type | created_on | chunk_size_bytes
-----------------------+------------------+-----------------+------------------------+-------------------------+------------------+-----------------+----------------------+---------------------+--------------------+-----------+-----------------+-----------------+------------+------------------
public."Hypertable_1" | public | Hypertable_1 | _sys_1_ | _hyper_1 | _sys_1_ | _hyper_1_root | _sys_1_ | _hyper_1_distinct | 1 | STICKY | time | bigint | Test1 | 1073741824
public."Hypertable_1" | public | Hypertable_1 | _sysinternal | _hyper_1 | _sysinternal | _hyper_1_root | _sysinternal | _hyper_1_distinct | 1 | STICKY | time | bigint | Test1 | 1073741824
(1 row)
SELECT * FROM hypertable;
name | main_schema_name | main_table_name | associated_schema_name | associated_table_prefix | root_schema_name | root_table_name | distinct_schema_name | distinct_table_name | replication_factor | placement | time_field_name | time_field_type | created_on | chunk_size_bytes
-----------------------+------------------+-----------------+------------------------+-------------------------+------------------+-----------------+----------------------+---------------------+--------------------+-----------+-----------------+-----------------+------------+------------------
public."Hypertable_1" | public | Hypertable_1 | _sys_1_ | _hyper_1 | _sys_1_ | _hyper_1_root | _sys_1_ | _hyper_1_distinct | 1 | STICKY | time | bigint | Test1 | 1073741824
public."Hypertable_1" | public | Hypertable_1 | _sysinternal | _hyper_1 | _sysinternal | _hyper_1_root | _sysinternal | _hyper_1_distinct | 1 | STICKY | time | bigint | Test1 | 1073741824
(1 row)
SELECT * FROM hypertable_index;
@ -123,8 +123,8 @@ Triggers:
insert_trigger AFTER INSERT ON "Hypertable_1" FOR EACH STATEMENT EXECUTE PROCEDURE _sysinternal.on_modify_main_table()
modify_trigger BEFORE DELETE OR UPDATE ON "Hypertable_1" FOR EACH STATEMENT EXECUTE PROCEDURE _sysinternal.on_unsupported_main_table()
\d+ "_sys_1_"."_hyper_1_root"
Table "_sys_1_._hyper_1_root"
\d+ "_sysinternal"."_hyper_1_root"
Table "_sysinternal._hyper_1_root"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+--------------------------------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -135,10 +135,10 @@ Triggers:
sensor_2 | numeric | not null default 1 | main | |
sensor_3 | numeric | not null default 1 | main | |
sensor_4 | numeric | not null default 1 | main | |
Child tables: _sys_1_._hyper_1_0_replica
Child tables: _sysinternal._hyper_1_0_replica
\d+ _sys_1_._hyper_1_1_0_1_data
Table "_sys_1_._hyper_1_1_0_1_data"
\d+ _sysinternal._hyper_1_1_0_1_data
Table "_sysinternal._hyper_1_1_0_1_data"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+--------------------------------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -156,7 +156,7 @@ Indexes:
"4-ind_sensor_1" btree ("time", sensor_1)
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Inherits: _sys_1_._hyper_1_1_0_partition
Inherits: _sysinternal._hyper_1_1_0_partition
SELECT * FROM PUBLIC.default_replica_node;
database_name | hypertable_name | replica_id
@ -187,8 +187,8 @@ Triggers:
insert_trigger AFTER INSERT ON "Hypertable_1" FOR EACH STATEMENT EXECUTE PROCEDURE _sysinternal.on_modify_main_table()
modify_trigger BEFORE DELETE OR UPDATE ON "Hypertable_1" FOR EACH STATEMENT EXECUTE PROCEDURE _sysinternal.on_unsupported_main_table()
\d+ "_sys_1_"."_hyper_1_root"
Table "_sys_1_._hyper_1_root"
\d+ "_sysinternal"."_hyper_1_root"
Table "_sysinternal._hyper_1_root"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+--------------------------------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -199,7 +199,7 @@ Triggers:
sensor_2 | numeric | not null default 1 | main | |
sensor_3 | numeric | not null default 1 | main | |
sensor_4 | numeric | not null default 1 | main | |
Child tables: _sys_1_._hyper_1_0_replica
Child tables: _sysinternal._hyper_1_0_replica
SELECT set_is_distinct_flag('"public"."Hypertable_1"', 'sensor_2', FALSE);
set_is_distinct_flag
@ -253,8 +253,8 @@ Triggers:
insert_trigger AFTER INSERT ON "Hypertable_1" FOR EACH STATEMENT EXECUTE PROCEDURE _sysinternal.on_modify_main_table()
modify_trigger BEFORE DELETE OR UPDATE ON "Hypertable_1" FOR EACH STATEMENT EXECUTE PROCEDURE _sysinternal.on_unsupported_main_table()
\d+ "_sys_1_"."_hyper_1_root"
Table "_sys_1_._hyper_1_root"
\d+ "_sysinternal"."_hyper_1_root"
Table "_sysinternal._hyper_1_root"
Column | Type | Modifiers | Storage | Stats target | Description
------------------+---------+------------------------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -266,9 +266,9 @@ Triggers:
temp_f | integer | not null default 31 | plain | |
sensor_3 | bigint | not null default 131 | plain | |
sensor_4 | bigint | not null default 131 | plain | |
Child tables: _sys_1_._hyper_1_0_replica
Child tables: _sysinternal._hyper_1_0_replica
SELECT * FROM _sys_1_._hyper_1_0_1_distinct_data;
SELECT * FROM _sysinternal._hyper_1_0_1_distinct_data;
field | value
-----------+-------
sensor_1 | 1
@ -296,8 +296,8 @@ Triggers:
insert_trigger AFTER INSERT ON "Hypertable_1" FOR EACH STATEMENT EXECUTE PROCEDURE _sysinternal.on_modify_main_table()
modify_trigger BEFORE DELETE OR UPDATE ON "Hypertable_1" FOR EACH STATEMENT EXECUTE PROCEDURE _sysinternal.on_unsupported_main_table()
\d+ "_sys_1_"."_hyper_1_root"
Table "_sys_1_._hyper_1_root"
\d+ "_sysinternal"."_hyper_1_root"
Table "_sysinternal._hyper_1_root"
Column | Type | Modifiers | Storage | Stats target | Description
------------------+---------+------------------------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -309,10 +309,10 @@ Triggers:
temp_f | integer | not null default 31 | plain | |
sensor_3 | bigint | not null default 131 | plain | |
sensor_4 | bigint | not null default 131 | plain | |
Child tables: _sys_1_._hyper_1_0_replica
Child tables: _sysinternal._hyper_1_0_replica
\d+ _sys_1_._hyper_1_1_0_1_data
Table "_sys_1_._hyper_1_1_0_1_data"
\d+ _sysinternal._hyper_1_1_0_1_data
Table "_sysinternal._hyper_1_1_0_1_data"
Column | Type | Modifiers | Storage | Stats target | Description
------------------+---------+------------------------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -329,7 +329,7 @@ Indexes:
"3-ind_humidity" btree ("time", humidity)
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Inherits: _sys_1_._hyper_1_1_0_partition
Inherits: _sysinternal._hyper_1_1_0_partition
SELECT * FROM PUBLIC."Hypertable_1";
time | Device_id | humidity | sensor_1 | sensor_2_renamed | sensor_3_renamed | temp_f | sensor_3 | sensor_4

View File

@ -0,0 +1,441 @@
\c Test1
\d+ "_sysinternal".*
Index "_sysinternal.1-testNs_device_id_timeCustom_idx"
Column | Type | Definition | Storage
------------+--------+--------------+----------
device_id | text | device_id | extended
timeCustom | bigint | "timeCustom" | plain
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (device_id IS NOT NULL)
Index "_sysinternal.10-testNs_timeCustom_series_bool_idx"
Column | Type | Definition | Storage
-------------+---------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_bool | boolean | series_bool | plain
btree, for table "_sysinternal._hyper_1_1_0_2_data", predicate (series_bool IS NOT NULL)
Index "_sysinternal.11-testNs_device_id_timeCustom_idx"
Column | Type | Definition | Storage
------------+--------+--------------+----------
device_id | text | device_id | extended
timeCustom | bigint | "timeCustom" | plain
btree, for table "_sysinternal._hyper_1_2_0_3_data", predicate (device_id IS NOT NULL)
Index "_sysinternal.12-testNs_timeCustom_series_0_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_0 | double precision | series_0 | plain
btree, for table "_sysinternal._hyper_1_2_0_3_data", predicate (series_0 IS NOT NULL)
Index "_sysinternal.13-testNs_timeCustom_series_1_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_1 | double precision | series_1 | plain
btree, for table "_sysinternal._hyper_1_2_0_3_data", predicate (series_1 IS NOT NULL)
Index "_sysinternal.14-testNs_timeCustom_series_2_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_2 | double precision | series_2 | plain
btree, for table "_sysinternal._hyper_1_2_0_3_data", predicate (series_2 IS NOT NULL)
Index "_sysinternal.15-testNs_timeCustom_series_bool_idx"
Column | Type | Definition | Storage
-------------+---------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_bool | boolean | series_bool | plain
btree, for table "_sysinternal._hyper_1_2_0_3_data", predicate (series_bool IS NOT NULL)
Index "_sysinternal.2-testNs_timeCustom_series_0_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_0 | double precision | series_0 | plain
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (series_0 IS NOT NULL)
Index "_sysinternal.3-testNs_timeCustom_series_1_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_1 | double precision | series_1 | plain
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (series_1 IS NOT NULL)
Index "_sysinternal.4-testNs_timeCustom_series_2_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_2 | double precision | series_2 | plain
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (series_2 IS NOT NULL)
Index "_sysinternal.5-testNs_timeCustom_series_bool_idx"
Column | Type | Definition | Storage
-------------+---------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_bool | boolean | series_bool | plain
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (series_bool IS NOT NULL)
Index "_sysinternal.6-testNs_device_id_timeCustom_idx"
Column | Type | Definition | Storage
------------+--------+--------------+----------
device_id | text | device_id | extended
timeCustom | bigint | "timeCustom" | plain
btree, for table "_sysinternal._hyper_1_1_0_2_data", predicate (device_id IS NOT NULL)
Index "_sysinternal.7-testNs_timeCustom_series_0_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_0 | double precision | series_0 | plain
btree, for table "_sysinternal._hyper_1_1_0_2_data", predicate (series_0 IS NOT NULL)
Index "_sysinternal.8-testNs_timeCustom_series_1_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_1 | double precision | series_1 | plain
btree, for table "_sysinternal._hyper_1_1_0_2_data", predicate (series_1 IS NOT NULL)
Index "_sysinternal.9-testNs_timeCustom_series_2_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_2 | double precision | series_2 | plain
btree, for table "_sysinternal._hyper_1_1_0_2_data", predicate (series_2 IS NOT NULL)
Table "_sysinternal._hyper_1_0_1_distinct_data"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_1_0_1_distinct_data_pkey" PRIMARY KEY, btree (field, value)
Inherits: _sysinternal._hyper_1_0_distinct
Index "_sysinternal._hyper_1_0_1_distinct_data_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "_sysinternal._hyper_1_0_1_distinct_data"
Table "_sysinternal._hyper_1_0_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Inherits: _sysinternal._hyper_1_distinct
Child tables: _sysinternal._hyper_1_0_1_distinct_data
Table "_sysinternal._hyper_1_0_replica"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
device_id | text | not null | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Inherits: _sysinternal._hyper_1_root
Child tables: _sysinternal._hyper_1_1_0_partition,
_sysinternal._hyper_1_2_0_partition
Table "_sysinternal._hyper_1_1_0_1_data"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
device_id | text | not null | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Indexes:
"1-testNs_device_id_timeCustom_idx" btree (device_id, "timeCustom" DESC NULLS LAST) WHERE device_id IS NOT NULL
"2-testNs_timeCustom_series_0_idx" btree ("timeCustom" DESC NULLS LAST, series_0) WHERE series_0 IS NOT NULL
"3-testNs_timeCustom_series_1_idx" btree ("timeCustom" DESC NULLS LAST, series_1) WHERE series_1 IS NOT NULL
"4-testNs_timeCustom_series_2_idx" btree ("timeCustom" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL
"5-testNs_timeCustom_series_bool_idx" btree ("timeCustom" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("timeCustom" <= '1257897600000000000'::bigint)
Inherits: _sysinternal._hyper_1_1_0_partition
Table "_sysinternal._hyper_1_1_0_2_data"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
device_id | text | not null | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Indexes:
"10-testNs_timeCustom_series_bool_idx" btree ("timeCustom" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL
"6-testNs_device_id_timeCustom_idx" btree (device_id, "timeCustom" DESC NULLS LAST) WHERE device_id IS NOT NULL
"7-testNs_timeCustom_series_0_idx" btree ("timeCustom" DESC NULLS LAST, series_0) WHERE series_0 IS NOT NULL
"8-testNs_timeCustom_series_1_idx" btree ("timeCustom" DESC NULLS LAST, series_1) WHERE series_1 IS NOT NULL
"9-testNs_timeCustom_series_2_idx" btree ("timeCustom" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("timeCustom" >= '1257897600000000001'::bigint)
Inherits: _sysinternal._hyper_1_1_0_partition
Table "_sysinternal._hyper_1_1_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
device_id | text | not null | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
Inherits: _sysinternal._hyper_1_0_replica
Child tables: _sysinternal._hyper_1_1_0_1_data,
_sysinternal._hyper_1_1_0_2_data
Table "_sysinternal._hyper_1_2_0_3_data"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
device_id | text | not null | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Indexes:
"11-testNs_device_id_timeCustom_idx" btree (device_id, "timeCustom" DESC NULLS LAST) WHERE device_id IS NOT NULL
"12-testNs_timeCustom_series_0_idx" btree ("timeCustom" DESC NULLS LAST, series_0) WHERE series_0 IS NOT NULL
"13-testNs_timeCustom_series_1_idx" btree ("timeCustom" DESC NULLS LAST, series_1) WHERE series_1 IS NOT NULL
"14-testNs_timeCustom_series_2_idx" btree ("timeCustom" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL
"15-testNs_timeCustom_series_bool_idx" btree ("timeCustom" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: _sysinternal._hyper_1_2_0_partition
Table "_sysinternal._hyper_1_2_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
device_id | text | not null | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: _sysinternal._hyper_1_0_replica
Child tables: _sysinternal._hyper_1_2_0_3_data
Table "_sysinternal._hyper_1_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_1_distinct_pkey" PRIMARY KEY, btree (field, value)
Child tables: _sysinternal._hyper_1_0_distinct
Index "_sysinternal._hyper_1_distinct_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "_sysinternal._hyper_1_distinct"
Table "_sysinternal._hyper_1_root"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
device_id | text | not null | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Child tables: _sysinternal._hyper_1_0_replica
Table "_sysinternal._hyper_2_0_1_distinct_data"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_2_0_1_distinct_data_pkey" PRIMARY KEY, btree (field, value)
Inherits: _sysinternal._hyper_2_0_distinct
Index "_sysinternal._hyper_2_0_1_distinct_data_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "_sysinternal._hyper_2_0_1_distinct_data"
Table "_sysinternal._hyper_2_0_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Inherits: _sysinternal._hyper_2_distinct
Child tables: _sysinternal._hyper_2_0_1_distinct_data
Table "_sysinternal._hyper_2_0_replica"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
time | bigint | | plain | |
metric | integer | | plain | |
device_id | text | | extended | |
Inherits: _sysinternal._hyper_2_root
Child tables: _sysinternal._hyper_2_3_0_partition,
_sysinternal._hyper_2_4_0_partition
Table "_sysinternal._hyper_2_3_0_4_data"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
time | bigint | | plain | |
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("time" <= '1'::bigint)
Inherits: _sysinternal._hyper_2_3_0_partition
Table "_sysinternal._hyper_2_3_0_5_data"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
time | bigint | | plain | |
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("time" >= '2'::bigint AND "time" <= '2'::bigint)
Inherits: _sysinternal._hyper_2_3_0_partition
Table "_sysinternal._hyper_2_3_0_6_data"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
time | bigint | | plain | |
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("time" >= '3'::bigint)
Inherits: _sysinternal._hyper_2_3_0_partition
Table "_sysinternal._hyper_2_3_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
time | bigint | | plain | |
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
Inherits: _sysinternal._hyper_2_0_replica
Child tables: _sysinternal._hyper_2_3_0_4_data,
_sysinternal._hyper_2_3_0_5_data,
_sysinternal._hyper_2_3_0_6_data
Table "_sysinternal._hyper_2_4_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
time | bigint | | plain | |
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: _sysinternal._hyper_2_0_replica
Table "_sysinternal._hyper_2_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_2_distinct_pkey" PRIMARY KEY, btree (field, value)
Child tables: _sysinternal._hyper_2_0_distinct
Index "_sysinternal._hyper_2_distinct_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "_sysinternal._hyper_2_distinct"
Table "_sysinternal._hyper_2_root"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
time | bigint | | plain | |
metric | integer | | plain | |
device_id | text | | extended | |
Child tables: _sysinternal._hyper_2_0_replica
\c test2
SELECT *
FROM "_sysinternal"._hyper_1_0_replica;
timeCustom | device_id | series_0 | series_1 | series_2 | series_bool
---------------------+-----------+----------+----------+----------+-------------
1257894000000000000 | dev1 | 1.5 | 1 | 2 | t
1257894000000000000 | dev1 | 1.5 | 2 | |
1257894000000001000 | dev1 | 2.5 | 3 | |
1257894001000000000 | dev1 | 3.5 | 4 | |
1257897600000000000 | dev1 | 4.5 | 5 | | f
1257894002000000000 | dev1 | 2.5 | 3 | |
1257987600000000000 | dev1 | 1.5 | 1 | |
1257987600000000000 | dev1 | 1.5 | 2 | |
1257894000000000000 | dev20 | 1.5 | 1 | |
1257894000000000000 | dev20 | 1.5 | 2 | |
(10 rows)
SELECT *
FROM "_sysinternal"._hyper_1_0_distinct;
field | value
-----------+-------
device_id | dev1
device_id | dev20
(2 rows)
SELECT * FROM hypertable;
name | main_schema_name | main_table_name | associated_schema_name | associated_table_prefix | root_schema_name | root_table_name | distinct_schema_name | distinct_table_name | replication_factor | placement | time_field_name | time_field_type | created_on | chunk_size_bytes
---------------------------+------------------+--------------------+------------------------+-------------------------+------------------+-----------------+----------------------+---------------------+--------------------+-----------+-----------------+-----------------+------------+------------------
testNs | public | testNs | _sysinternal | _hyper_1 | _sysinternal | _hyper_1_root | _sysinternal | _hyper_1_distinct | 1 | STICKY | timeCustom | bigint | Test1 | 1073741824
public.chunk_closing_test | public | chunk_closing_test | _sysinternal | _hyper_2 | _sysinternal | _hyper_2_root | _sysinternal | _hyper_2_distinct | 1 | STICKY | time | bigint | Test1 | 10000
(2 rows)
DROP TABLE "testNs";
SELECT * FROM hypertable;
name | main_schema_name | main_table_name | associated_schema_name | associated_table_prefix | root_schema_name | root_table_name | distinct_schema_name | distinct_table_name | replication_factor | placement | time_field_name | time_field_type | created_on | chunk_size_bytes
---------------------------+------------------+--------------------+------------------------+-------------------------+------------------+-----------------+----------------------+---------------------+--------------------+-----------+-----------------+-----------------+------------+------------------
public.chunk_closing_test | public | chunk_closing_test | _sysinternal | _hyper_2 | _sysinternal | _hyper_2_root | _sysinternal | _hyper_2_distinct | 1 | STICKY | time | bigint | Test1 | 10000
(1 row)
\dt+ "_sysinternal".*
List of relations
Schema | Name | Type | Owner | Size | Description
--------------+------------------------+-------+----------+------------+-------------
_sysinternal | _hyper_2_0_distinct | table | postgres | 8192 bytes |
_sysinternal | _hyper_2_0_replica | table | postgres | 8192 bytes |
_sysinternal | _hyper_2_3_0_partition | table | postgres | 8192 bytes |
_sysinternal | _hyper_2_4_0_partition | table | postgres | 8192 bytes |
_sysinternal | _hyper_2_distinct | table | postgres | 8192 bytes |
_sysinternal | _hyper_2_root | table | postgres | 8192 bytes |
(6 rows)
\c Test1
\dt+ "_sysinternal".*
List of relations
Schema | Name | Type | Owner | Size | Description
--------------+----------------------------+-------+----------+------------+-------------
_sysinternal | _hyper_2_0_1_distinct_data | table | postgres | 8192 bytes |
_sysinternal | _hyper_2_0_distinct | table | postgres | 8192 bytes |
_sysinternal | _hyper_2_0_replica | table | postgres | 8192 bytes |
_sysinternal | _hyper_2_3_0_4_data | table | postgres | 16 kB |
_sysinternal | _hyper_2_3_0_5_data | table | postgres | 16 kB |
_sysinternal | _hyper_2_3_0_6_data | table | postgres | 16 kB |
_sysinternal | _hyper_2_3_0_partition | table | postgres | 8192 bytes |
_sysinternal | _hyper_2_4_0_partition | table | postgres | 8192 bytes |
_sysinternal | _hyper_2_distinct | table | postgres | 8192 bytes |
_sysinternal | _hyper_2_root | table | postgres | 8192 bytes |
(10 rows)

View File

@ -70,10 +70,10 @@ CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_0) WHERE s
CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_1) WHERE series_1 IS NOT NULL;
CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL;
CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL;
SELECT * FROM create_hypertable('"public"."testNs"', 'timeCustom', 'device_id', hypertable_name=>'testNs', associated_schema_name=>'testNs' );
SELECT * FROM create_hypertable('"public"."testNs"', 'timeCustom', 'device_id', hypertable_name=>'testNs', associated_schema_name=>'_sysinternal' );
name | main_schema_name | main_table_name | associated_schema_name | associated_table_prefix | root_schema_name | root_table_name | distinct_schema_name | distinct_table_name | replication_factor | placement | time_field_name | time_field_type | created_on | chunk_size_bytes
--------+------------------+-----------------+------------------------+-------------------------+------------------+-----------------+----------------------+---------------------+--------------------+-----------+-----------------+-----------------+------------+------------------
testNs | public | testNs | testNs | _hyper_1 | testNs | _hyper_1_root | testNs | _hyper_1_distinct | 1 | STICKY | timeCustom | bigint | Test1 | 1073741824
testNs | public | testNs | _sysinternal | _hyper_1 | _sysinternal | _hyper_1_root | _sysinternal | _hyper_1_distinct | 1 | STICKY | timeCustom | bigint | Test1 | 1073741824
(1 row)
SELECT set_is_distinct_flag('"public"."testNs"', 'device_id', TRUE);
@ -113,7 +113,7 @@ CREATE TABLE chunk_closing_test(
SELECT * FROM create_hypertable('chunk_closing_test', 'time', 'device_id', chunk_size_bytes => 10000);
name | main_schema_name | main_table_name | associated_schema_name | associated_table_prefix | root_schema_name | root_table_name | distinct_schema_name | distinct_table_name | replication_factor | placement | time_field_name | time_field_type | created_on | chunk_size_bytes
---------------------------+------------------+--------------------+------------------------+-------------------------+------------------+-----------------+----------------------+---------------------+--------------------+-----------+-----------------+-----------------+------------+------------------
public.chunk_closing_test | public | chunk_closing_test | _sys_2_ | _hyper_2 | _sys_2_ | _hyper_2_root | _sys_2_ | _hyper_2_distinct | 1 | STICKY | time | bigint | Test1 | 10000
public.chunk_closing_test | public | chunk_closing_test | _sysinternal | _hyper_2 | _sysinternal | _hyper_2_root | _sysinternal | _hyper_2_distinct | 1 | STICKY | time | bigint | Test1 | 10000
(1 row)
INSERT INTO chunk_closing_test VALUES(1, 1, 'dev1');
@ -132,144 +132,144 @@ SELECT * FROM chunk c
LEFT JOIN partition_replica pr ON (crn.partition_replica_id = pr.id)
WHERE hypertable_name = 'public.chunk_closing_test';
id | partition_id | start_time | end_time | chunk_id | partition_replica_id | database_name | schema_name | table_name | id | partition_id | hypertable_name | replica_id | schema_name | table_name
----+--------------+------------+----------+----------+----------------------+---------------+-------------+---------------------+----+--------------+---------------------------+------------+-------------+------------------------
4 | 3 | | 1 | 4 | 3 | Test1 | _sys_2_ | _hyper_2_3_0_4_data | 3 | 3 | public.chunk_closing_test | 0 | _sys_2_ | _hyper_2_3_0_partition
5 | 3 | 2 | 2 | 5 | 3 | Test1 | _sys_2_ | _hyper_2_3_0_5_data | 3 | 3 | public.chunk_closing_test | 0 | _sys_2_ | _hyper_2_3_0_partition
6 | 3 | 3 | | 6 | 3 | Test1 | _sys_2_ | _hyper_2_3_0_6_data | 3 | 3 | public.chunk_closing_test | 0 | _sys_2_ | _hyper_2_3_0_partition
----+--------------+------------+----------+----------+----------------------+---------------+--------------+---------------------+----+--------------+---------------------------+------------+--------------+------------------------
4 | 3 | | 1 | 4 | 3 | Test1 | _sysinternal | _hyper_2_3_0_4_data | 3 | 3 | public.chunk_closing_test | 0 | _sysinternal | _hyper_2_3_0_partition
5 | 3 | 2 | 2 | 5 | 3 | Test1 | _sysinternal | _hyper_2_3_0_5_data | 3 | 3 | public.chunk_closing_test | 0 | _sysinternal | _hyper_2_3_0_partition
6 | 3 | 3 | | 6 | 3 | Test1 | _sysinternal | _hyper_2_3_0_6_data | 3 | 3 | public.chunk_closing_test | 0 | _sysinternal | _hyper_2_3_0_partition
(3 rows)
\c Test1
\d+ "testNs".*
Index "testNs.1-testNs_device_id_timeCustom_idx"
\d+ "_sysinternal".*
Index "_sysinternal.1-testNs_device_id_timeCustom_idx"
Column | Type | Definition | Storage
------------+--------+--------------+----------
device_id | text | device_id | extended
timeCustom | bigint | "timeCustom" | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (device_id IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (device_id IS NOT NULL)
Index "testNs.10-testNs_timeCustom_series_bool_idx"
Index "_sysinternal.10-testNs_timeCustom_series_bool_idx"
Column | Type | Definition | Storage
-------------+---------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_bool | boolean | series_bool | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (series_bool IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_2_data", predicate (series_bool IS NOT NULL)
Index "testNs.11-testNs_device_id_timeCustom_idx"
Index "_sysinternal.11-testNs_device_id_timeCustom_idx"
Column | Type | Definition | Storage
------------+--------+--------------+----------
device_id | text | device_id | extended
timeCustom | bigint | "timeCustom" | plain
btree, for table "testNs._hyper_1_2_0_3_data", predicate (device_id IS NOT NULL)
btree, for table "_sysinternal._hyper_1_2_0_3_data", predicate (device_id IS NOT NULL)
Index "testNs.12-testNs_timeCustom_series_0_idx"
Index "_sysinternal.12-testNs_timeCustom_series_0_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_0 | double precision | series_0 | plain
btree, for table "testNs._hyper_1_2_0_3_data", predicate (series_0 IS NOT NULL)
btree, for table "_sysinternal._hyper_1_2_0_3_data", predicate (series_0 IS NOT NULL)
Index "testNs.13-testNs_timeCustom_series_1_idx"
Index "_sysinternal.13-testNs_timeCustom_series_1_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_1 | double precision | series_1 | plain
btree, for table "testNs._hyper_1_2_0_3_data", predicate (series_1 IS NOT NULL)
btree, for table "_sysinternal._hyper_1_2_0_3_data", predicate (series_1 IS NOT NULL)
Index "testNs.14-testNs_timeCustom_series_2_idx"
Index "_sysinternal.14-testNs_timeCustom_series_2_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_2 | double precision | series_2 | plain
btree, for table "testNs._hyper_1_2_0_3_data", predicate (series_2 IS NOT NULL)
btree, for table "_sysinternal._hyper_1_2_0_3_data", predicate (series_2 IS NOT NULL)
Index "testNs.15-testNs_timeCustom_series_bool_idx"
Index "_sysinternal.15-testNs_timeCustom_series_bool_idx"
Column | Type | Definition | Storage
-------------+---------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_bool | boolean | series_bool | plain
btree, for table "testNs._hyper_1_2_0_3_data", predicate (series_bool IS NOT NULL)
btree, for table "_sysinternal._hyper_1_2_0_3_data", predicate (series_bool IS NOT NULL)
Index "testNs.2-testNs_timeCustom_series_0_idx"
Index "_sysinternal.2-testNs_timeCustom_series_0_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_0 | double precision | series_0 | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (series_0 IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (series_0 IS NOT NULL)
Index "testNs.3-testNs_timeCustom_series_1_idx"
Index "_sysinternal.3-testNs_timeCustom_series_1_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_1 | double precision | series_1 | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (series_1 IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (series_1 IS NOT NULL)
Index "testNs.4-testNs_timeCustom_series_2_idx"
Index "_sysinternal.4-testNs_timeCustom_series_2_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_2 | double precision | series_2 | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (series_2 IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (series_2 IS NOT NULL)
Index "testNs.5-testNs_timeCustom_series_bool_idx"
Index "_sysinternal.5-testNs_timeCustom_series_bool_idx"
Column | Type | Definition | Storage
-------------+---------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_bool | boolean | series_bool | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (series_bool IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_1_data", predicate (series_bool IS NOT NULL)
Index "testNs.6-testNs_device_id_timeCustom_idx"
Index "_sysinternal.6-testNs_device_id_timeCustom_idx"
Column | Type | Definition | Storage
------------+--------+--------------+----------
device_id | text | device_id | extended
timeCustom | bigint | "timeCustom" | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (device_id IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_2_data", predicate (device_id IS NOT NULL)
Index "testNs.7-testNs_timeCustom_series_0_idx"
Index "_sysinternal.7-testNs_timeCustom_series_0_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_0 | double precision | series_0 | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (series_0 IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_2_data", predicate (series_0 IS NOT NULL)
Index "testNs.8-testNs_timeCustom_series_1_idx"
Index "_sysinternal.8-testNs_timeCustom_series_1_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_1 | double precision | series_1 | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (series_1 IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_2_data", predicate (series_1 IS NOT NULL)
Index "testNs.9-testNs_timeCustom_series_2_idx"
Index "_sysinternal.9-testNs_timeCustom_series_2_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_2 | double precision | series_2 | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (series_2 IS NOT NULL)
btree, for table "_sysinternal._hyper_1_1_0_2_data", predicate (series_2 IS NOT NULL)
Table "testNs._hyper_1_0_1_distinct_data"
Table "_sysinternal._hyper_1_0_1_distinct_data"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_1_0_1_distinct_data_pkey" PRIMARY KEY, btree (field, value)
Inherits: "testNs"._hyper_1_0_distinct
Inherits: _sysinternal._hyper_1_0_distinct
Index "testNs._hyper_1_0_1_distinct_data_pkey"
Index "_sysinternal._hyper_1_0_1_distinct_data_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "testNs._hyper_1_0_1_distinct_data"
primary key, btree, for table "_sysinternal._hyper_1_0_1_distinct_data"
Table "testNs._hyper_1_0_distinct"
Table "_sysinternal._hyper_1_0_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Inherits: "testNs"._hyper_1_distinct
Child tables: "testNs"._hyper_1_0_1_distinct_data
Inherits: _sysinternal._hyper_1_distinct
Child tables: _sysinternal._hyper_1_0_1_distinct_data
Table "testNs._hyper_1_0_replica"
Table "_sysinternal._hyper_1_0_replica"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
@ -278,11 +278,11 @@ Child tables: "testNs"._hyper_1_0_1_distinct_data
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Inherits: "testNs"._hyper_1_root
Child tables: "testNs"._hyper_1_1_0_partition,
"testNs"._hyper_1_2_0_partition
Inherits: _sysinternal._hyper_1_root
Child tables: _sysinternal._hyper_1_1_0_partition,
_sysinternal._hyper_1_2_0_partition
Table "testNs._hyper_1_1_0_1_data"
Table "_sysinternal._hyper_1_1_0_1_data"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
@ -300,9 +300,9 @@ Indexes:
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("timeCustom" <= '1257897600000000000'::bigint)
Inherits: "testNs"._hyper_1_1_0_partition
Inherits: _sysinternal._hyper_1_1_0_partition
Table "testNs._hyper_1_1_0_2_data"
Table "_sysinternal._hyper_1_1_0_2_data"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
@ -320,9 +320,9 @@ Indexes:
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("timeCustom" >= '1257897600000000001'::bigint)
Inherits: "testNs"._hyper_1_1_0_partition
Inherits: _sysinternal._hyper_1_1_0_partition
Table "testNs._hyper_1_1_0_partition"
Table "_sysinternal._hyper_1_1_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
@ -333,11 +333,11 @@ Inherits: "testNs"._hyper_1_1_0_partition
series_bool | boolean | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
Inherits: "testNs"._hyper_1_0_replica
Child tables: "testNs"._hyper_1_1_0_1_data,
"testNs"._hyper_1_1_0_2_data
Inherits: _sysinternal._hyper_1_0_replica
Child tables: _sysinternal._hyper_1_1_0_1_data,
_sysinternal._hyper_1_1_0_2_data
Table "testNs._hyper_1_2_0_3_data"
Table "_sysinternal._hyper_1_2_0_3_data"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
@ -354,9 +354,9 @@ Indexes:
"15-testNs_timeCustom_series_bool_idx" btree ("timeCustom" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: "testNs"._hyper_1_2_0_partition
Inherits: _sysinternal._hyper_1_2_0_partition
Table "testNs._hyper_1_2_0_partition"
Table "_sysinternal._hyper_1_2_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
@ -367,26 +367,26 @@ Inherits: "testNs"._hyper_1_2_0_partition
series_bool | boolean | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: "testNs"._hyper_1_0_replica
Child tables: "testNs"._hyper_1_2_0_3_data
Inherits: _sysinternal._hyper_1_0_replica
Child tables: _sysinternal._hyper_1_2_0_3_data
Table "testNs._hyper_1_distinct"
Table "_sysinternal._hyper_1_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_1_distinct_pkey" PRIMARY KEY, btree (field, value)
Child tables: "testNs"._hyper_1_0_distinct
Child tables: _sysinternal._hyper_1_0_distinct
Index "testNs._hyper_1_distinct_pkey"
Index "_sysinternal._hyper_1_distinct_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "testNs._hyper_1_distinct"
primary key, btree, for table "_sysinternal._hyper_1_distinct"
Table "testNs._hyper_1_root"
Table "_sysinternal._hyper_1_root"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
@ -395,28 +395,142 @@ primary key, btree, for table "testNs._hyper_1_distinct"
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Child tables: "testNs"._hyper_1_0_replica
Child tables: _sysinternal._hyper_1_0_replica
Table "_sysinternal._hyper_2_0_1_distinct_data"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_2_0_1_distinct_data_pkey" PRIMARY KEY, btree (field, value)
Inherits: _sysinternal._hyper_2_0_distinct
Index "_sysinternal._hyper_2_0_1_distinct_data_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "_sysinternal._hyper_2_0_1_distinct_data"
Table "_sysinternal._hyper_2_0_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Inherits: _sysinternal._hyper_2_distinct
Child tables: _sysinternal._hyper_2_0_1_distinct_data
Table "_sysinternal._hyper_2_0_replica"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
time | bigint | | plain | |
metric | integer | | plain | |
device_id | text | | extended | |
Inherits: _sysinternal._hyper_2_root
Child tables: _sysinternal._hyper_2_3_0_partition,
_sysinternal._hyper_2_4_0_partition
Table "_sysinternal._hyper_2_3_0_4_data"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
time | bigint | | plain | |
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("time" <= '1'::bigint)
Inherits: _sysinternal._hyper_2_3_0_partition
Table "_sysinternal._hyper_2_3_0_5_data"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
time | bigint | | plain | |
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("time" >= '2'::bigint AND "time" <= '2'::bigint)
Inherits: _sysinternal._hyper_2_3_0_partition
Table "_sysinternal._hyper_2_3_0_6_data"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
time | bigint | | plain | |
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("time" >= '3'::bigint)
Inherits: _sysinternal._hyper_2_3_0_partition
Table "_sysinternal._hyper_2_3_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
time | bigint | | plain | |
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
Inherits: _sysinternal._hyper_2_0_replica
Child tables: _sysinternal._hyper_2_3_0_4_data,
_sysinternal._hyper_2_3_0_5_data,
_sysinternal._hyper_2_3_0_6_data
Table "_sysinternal._hyper_2_4_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
time | bigint | | plain | |
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: _sysinternal._hyper_2_0_replica
Table "_sysinternal._hyper_2_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_2_distinct_pkey" PRIMARY KEY, btree (field, value)
Child tables: _sysinternal._hyper_2_0_distinct
Index "_sysinternal._hyper_2_distinct_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "_sysinternal._hyper_2_distinct"
Table "_sysinternal._hyper_2_root"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
time | bigint | | plain | |
metric | integer | | plain | |
device_id | text | | extended | |
Child tables: _sysinternal._hyper_2_0_replica
\c test2
\d+ "testNs".*
Foreign table "testNs._hyper_1_0_1_distinct_data"
\d+ "_sysinternal".*
Foreign table "_sysinternal._hyper_1_0_1_distinct_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
--------+------+-----------+-------------+----------+--------------+-------------
field | text | not null | | extended | |
value | text | not null | | extended | |
Server: Test1
FDW Options: (schema_name 'testNs', table_name '_hyper_1_0_1_distinct_data')
Inherits: "testNs"._hyper_1_0_distinct
FDW Options: (schema_name '_sysinternal', table_name '_hyper_1_0_1_distinct_data')
Inherits: _sysinternal._hyper_1_0_distinct
Table "testNs._hyper_1_0_distinct"
Table "_sysinternal._hyper_1_0_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Inherits: "testNs"._hyper_1_distinct
Child tables: "testNs"._hyper_1_0_1_distinct_data
Inherits: _sysinternal._hyper_1_distinct
Child tables: _sysinternal._hyper_1_0_1_distinct_data
Table "testNs._hyper_1_0_replica"
Table "_sysinternal._hyper_1_0_replica"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
@ -425,11 +539,11 @@ Child tables: "testNs"._hyper_1_0_1_distinct_data
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Inherits: "testNs"._hyper_1_root
Child tables: "testNs"._hyper_1_1_0_partition,
"testNs"._hyper_1_2_0_partition
Inherits: _sysinternal._hyper_1_root
Child tables: _sysinternal._hyper_1_1_0_partition,
_sysinternal._hyper_1_2_0_partition
Foreign table "testNs._hyper_1_1_0_1_data"
Foreign table "_sysinternal._hyper_1_1_0_1_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
-------------+------------------+-----------+-------------+----------+--------------+-------------
timeCustom | bigint | not null | | plain | |
@ -442,10 +556,10 @@ Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("timeCustom" <= '1257897600000000000'::bigint)
Server: Test1
FDW Options: (schema_name 'testNs', table_name '_hyper_1_1_0_1_data')
Inherits: "testNs"._hyper_1_1_0_partition
FDW Options: (schema_name '_sysinternal', table_name '_hyper_1_1_0_1_data')
Inherits: _sysinternal._hyper_1_1_0_partition
Foreign table "testNs._hyper_1_1_0_2_data"
Foreign table "_sysinternal._hyper_1_1_0_2_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
-------------+------------------+-----------+-------------+----------+--------------+-------------
timeCustom | bigint | not null | | plain | |
@ -458,10 +572,10 @@ Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("timeCustom" >= '1257897600000000001'::bigint)
Server: Test1
FDW Options: (schema_name 'testNs', table_name '_hyper_1_1_0_2_data')
Inherits: "testNs"._hyper_1_1_0_partition
FDW Options: (schema_name '_sysinternal', table_name '_hyper_1_1_0_2_data')
Inherits: _sysinternal._hyper_1_1_0_partition
Table "testNs._hyper_1_1_0_partition"
Table "_sysinternal._hyper_1_1_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
@ -472,11 +586,11 @@ Inherits: "testNs"._hyper_1_1_0_partition
series_bool | boolean | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
Inherits: "testNs"._hyper_1_0_replica
Child tables: "testNs"._hyper_1_1_0_1_data,
"testNs"._hyper_1_1_0_2_data
Inherits: _sysinternal._hyper_1_0_replica
Child tables: _sysinternal._hyper_1_1_0_1_data,
_sysinternal._hyper_1_1_0_2_data
Foreign table "testNs._hyper_1_2_0_3_data"
Foreign table "_sysinternal._hyper_1_2_0_3_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
-------------+------------------+-----------+-------------+----------+--------------+-------------
timeCustom | bigint | not null | | plain | |
@ -488,10 +602,10 @@ Child tables: "testNs"._hyper_1_1_0_1_data,
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Server: Test1
FDW Options: (schema_name 'testNs', table_name '_hyper_1_2_0_3_data')
Inherits: "testNs"._hyper_1_2_0_partition
FDW Options: (schema_name '_sysinternal', table_name '_hyper_1_2_0_3_data')
Inherits: _sysinternal._hyper_1_2_0_partition
Table "testNs._hyper_1_2_0_partition"
Table "_sysinternal._hyper_1_2_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
@ -502,26 +616,26 @@ Inherits: "testNs"._hyper_1_2_0_partition
series_bool | boolean | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: "testNs"._hyper_1_0_replica
Child tables: "testNs"._hyper_1_2_0_3_data
Inherits: _sysinternal._hyper_1_0_replica
Child tables: _sysinternal._hyper_1_2_0_3_data
Table "testNs._hyper_1_distinct"
Table "_sysinternal._hyper_1_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_1_distinct_pkey" PRIMARY KEY, btree (field, value)
Child tables: "testNs"._hyper_1_0_distinct
Child tables: _sysinternal._hyper_1_0_distinct
Index "testNs._hyper_1_distinct_pkey"
Index "_sysinternal._hyper_1_distinct_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "testNs._hyper_1_distinct"
primary key, btree, for table "_sysinternal._hyper_1_distinct"
Table "testNs._hyper_1_root"
Table "_sysinternal._hyper_1_root"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
@ -530,10 +644,123 @@ primary key, btree, for table "testNs._hyper_1_distinct"
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Child tables: "testNs"._hyper_1_0_replica
Child tables: _sysinternal._hyper_1_0_replica
Foreign table "_sysinternal._hyper_2_0_1_distinct_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
--------+------+-----------+-------------+----------+--------------+-------------
field | text | not null | | extended | |
value | text | not null | | extended | |
Server: Test1
FDW Options: (schema_name '_sysinternal', table_name '_hyper_2_0_1_distinct_data')
Inherits: _sysinternal._hyper_2_0_distinct
Table "_sysinternal._hyper_2_0_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Inherits: _sysinternal._hyper_2_distinct
Child tables: _sysinternal._hyper_2_0_1_distinct_data
Table "_sysinternal._hyper_2_0_replica"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
time | bigint | | plain | |
metric | integer | | plain | |
device_id | text | | extended | |
Inherits: _sysinternal._hyper_2_root
Child tables: _sysinternal._hyper_2_3_0_partition,
_sysinternal._hyper_2_4_0_partition
Foreign table "_sysinternal._hyper_2_3_0_4_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
-----------+---------+-----------+-------------+----------+--------------+-------------
time | bigint | | | plain | |
metric | integer | | | plain | |
device_id | text | | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("time" <= '1'::bigint)
Server: Test1
FDW Options: (schema_name '_sysinternal', table_name '_hyper_2_3_0_4_data')
Inherits: _sysinternal._hyper_2_3_0_partition
Foreign table "_sysinternal._hyper_2_3_0_5_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
-----------+---------+-----------+-------------+----------+--------------+-------------
time | bigint | | | plain | |
metric | integer | | | plain | |
device_id | text | | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("time" >= '2'::bigint AND "time" <= '2'::bigint)
Server: Test1
FDW Options: (schema_name '_sysinternal', table_name '_hyper_2_3_0_5_data')
Inherits: _sysinternal._hyper_2_3_0_partition
Foreign table "_sysinternal._hyper_2_3_0_6_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
-----------+---------+-----------+-------------+----------+--------------+-------------
time | bigint | | | plain | |
metric | integer | | | plain | |
device_id | text | | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("time" >= '3'::bigint)
Server: Test1
FDW Options: (schema_name '_sysinternal', table_name '_hyper_2_3_0_6_data')
Inherits: _sysinternal._hyper_2_3_0_partition
Table "_sysinternal._hyper_2_3_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
time | bigint | | plain | |
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
Inherits: _sysinternal._hyper_2_0_replica
Child tables: _sysinternal._hyper_2_3_0_4_data,
_sysinternal._hyper_2_3_0_5_data,
_sysinternal._hyper_2_3_0_6_data
Table "_sysinternal._hyper_2_4_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
time | bigint | | plain | |
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: _sysinternal._hyper_2_0_replica
Table "_sysinternal._hyper_2_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_2_distinct_pkey" PRIMARY KEY, btree (field, value)
Child tables: _sysinternal._hyper_2_0_distinct
Index "_sysinternal._hyper_2_distinct_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "_sysinternal._hyper_2_distinct"
Table "_sysinternal._hyper_2_root"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
time | bigint | | plain | |
metric | integer | | plain | |
device_id | text | | extended | |
Child tables: _sysinternal._hyper_2_0_replica
SELECT *
FROM "testNs"._hyper_1_0_replica;
FROM "_sysinternal"._hyper_1_0_replica;
timeCustom | device_id | series_0 | series_1 | series_2 | series_bool
---------------------+-----------+----------+----------+----------+-------------
1257894000000000000 | dev1 | 1.5 | 1 | 2 | t
@ -549,7 +776,7 @@ FROM "testNs"._hyper_1_0_replica;
(10 rows)
SELECT *
FROM "testNs"._hyper_1_0_distinct;
FROM "_sysinternal"._hyper_1_0_distinct;
field | value
-----------+-------
device_id | dev1

View File

@ -18,17 +18,17 @@ EXPLAIN (verbose ON, costs off) SELECT * FROM "testNs";
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Append
-> Seq Scan on "testNs"._hyper_1_0_replica
-> Seq Scan on _sysinternal._hyper_1_0_replica
Output: _hyper_1_0_replica."timeCustom", _hyper_1_0_replica.device_id, _hyper_1_0_replica.series_0, _hyper_1_0_replica.series_1, _hyper_1_0_replica.series_2, _hyper_1_0_replica.series_bool
-> Seq Scan on "testNs"._hyper_1_1_0_partition
-> Seq Scan on _sysinternal._hyper_1_1_0_partition
Output: _hyper_1_1_0_partition."timeCustom", _hyper_1_1_0_partition.device_id, _hyper_1_1_0_partition.series_0, _hyper_1_1_0_partition.series_1, _hyper_1_1_0_partition.series_2, _hyper_1_1_0_partition.series_bool
-> Seq Scan on "testNs"._hyper_1_2_0_partition
-> Seq Scan on _sysinternal._hyper_1_2_0_partition
Output: _hyper_1_2_0_partition."timeCustom", _hyper_1_2_0_partition.device_id, _hyper_1_2_0_partition.series_0, _hyper_1_2_0_partition.series_1, _hyper_1_2_0_partition.series_2, _hyper_1_2_0_partition.series_bool
-> Seq Scan on "testNs"._hyper_1_1_0_1_data
-> Seq Scan on _sysinternal._hyper_1_1_0_1_data
Output: _hyper_1_1_0_1_data."timeCustom", _hyper_1_1_0_1_data.device_id, _hyper_1_1_0_1_data.series_0, _hyper_1_1_0_1_data.series_1, _hyper_1_1_0_1_data.series_2, _hyper_1_1_0_1_data.series_bool
-> Seq Scan on "testNs"._hyper_1_1_0_2_data
-> Seq Scan on _sysinternal._hyper_1_1_0_2_data
Output: _hyper_1_1_0_2_data."timeCustom", _hyper_1_1_0_2_data.device_id, _hyper_1_1_0_2_data.series_0, _hyper_1_1_0_2_data.series_1, _hyper_1_1_0_2_data.series_2, _hyper_1_1_0_2_data.series_bool
-> Seq Scan on "testNs"._hyper_1_2_0_3_data
-> Seq Scan on _sysinternal._hyper_1_2_0_3_data
Output: _hyper_1_2_0_3_data."timeCustom", _hyper_1_2_0_3_data.device_id, _hyper_1_2_0_3_data.series_0, _hyper_1_2_0_3_data.series_1, _hyper_1_2_0_3_data.series_2, _hyper_1_2_0_3_data.series_bool
(13 rows)
@ -38,13 +38,13 @@ EXPLAIN (verbose ON, costs off) SELECT * FROM "testNs" WHERE device_id = 'dev20'
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Append
-> Seq Scan on "testNs"._hyper_1_0_replica
-> Seq Scan on _sysinternal._hyper_1_0_replica
Output: _hyper_1_0_replica."timeCustom", _hyper_1_0_replica.device_id, _hyper_1_0_replica.series_0, _hyper_1_0_replica.series_1, _hyper_1_0_replica.series_2, _hyper_1_0_replica.series_bool
Filter: ((_hyper_1_0_replica.device_id = 'dev20'::text) AND ((((_sysinternal.murmur3_hash_string(_hyper_1_0_replica.device_id, 1) & 2147483647) % 32768))::smallint = '28646'::smallint))
-> Seq Scan on "testNs"._hyper_1_2_0_partition
-> Seq Scan on _sysinternal._hyper_1_2_0_partition
Output: _hyper_1_2_0_partition."timeCustom", _hyper_1_2_0_partition.device_id, _hyper_1_2_0_partition.series_0, _hyper_1_2_0_partition.series_1, _hyper_1_2_0_partition.series_2, _hyper_1_2_0_partition.series_bool
Filter: ((_hyper_1_2_0_partition.device_id = 'dev20'::text) AND ((((_sysinternal.murmur3_hash_string(_hyper_1_2_0_partition.device_id, 1) & 2147483647) % 32768))::smallint = '28646'::smallint))
-> Bitmap Heap Scan on "testNs"._hyper_1_2_0_3_data
-> Bitmap Heap Scan on _sysinternal._hyper_1_2_0_3_data
Output: _hyper_1_2_0_3_data."timeCustom", _hyper_1_2_0_3_data.device_id, _hyper_1_2_0_3_data.series_0, _hyper_1_2_0_3_data.series_1, _hyper_1_2_0_3_data.series_2, _hyper_1_2_0_3_data.series_bool
Recheck Cond: (_hyper_1_2_0_3_data.device_id = 'dev20'::text)
Filter: ((((_sysinternal.murmur3_hash_string(_hyper_1_2_0_3_data.device_id, 1) & 2147483647) % 32768))::smallint = '28646'::smallint)
@ -56,13 +56,13 @@ EXPLAIN (verbose ON, costs off) SELECT * FROM "testNs" WHERE device_id = 'dev'||
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Append
-> Seq Scan on "testNs"._hyper_1_0_replica
-> Seq Scan on _sysinternal._hyper_1_0_replica
Output: _hyper_1_0_replica."timeCustom", _hyper_1_0_replica.device_id, _hyper_1_0_replica.series_0, _hyper_1_0_replica.series_1, _hyper_1_0_replica.series_2, _hyper_1_0_replica.series_bool
Filter: ((_hyper_1_0_replica.device_id = 'dev20'::text) AND ((((_sysinternal.murmur3_hash_string(_hyper_1_0_replica.device_id, 1) & 2147483647) % 32768))::smallint = '28646'::smallint))
-> Seq Scan on "testNs"._hyper_1_2_0_partition
-> Seq Scan on _sysinternal._hyper_1_2_0_partition
Output: _hyper_1_2_0_partition."timeCustom", _hyper_1_2_0_partition.device_id, _hyper_1_2_0_partition.series_0, _hyper_1_2_0_partition.series_1, _hyper_1_2_0_partition.series_2, _hyper_1_2_0_partition.series_bool
Filter: ((_hyper_1_2_0_partition.device_id = 'dev20'::text) AND ((((_sysinternal.murmur3_hash_string(_hyper_1_2_0_partition.device_id, 1) & 2147483647) % 32768))::smallint = '28646'::smallint))
-> Bitmap Heap Scan on "testNs"._hyper_1_2_0_3_data
-> Bitmap Heap Scan on _sysinternal._hyper_1_2_0_3_data
Output: _hyper_1_2_0_3_data."timeCustom", _hyper_1_2_0_3_data.device_id, _hyper_1_2_0_3_data.series_0, _hyper_1_2_0_3_data.series_1, _hyper_1_2_0_3_data.series_2, _hyper_1_2_0_3_data.series_bool
Recheck Cond: (_hyper_1_2_0_3_data.device_id = 'dev20'::text)
Filter: ((((_sysinternal.murmur3_hash_string(_hyper_1_2_0_3_data.device_id, 1) & 2147483647) % 32768))::smallint = '28646'::smallint)
@ -74,13 +74,13 @@ EXPLAIN (verbose ON, costs off) SELECT * FROM "testNs" WHERE 'dev'||'20' = devic
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Append
-> Seq Scan on "testNs"._hyper_1_0_replica
-> Seq Scan on _sysinternal._hyper_1_0_replica
Output: _hyper_1_0_replica."timeCustom", _hyper_1_0_replica.device_id, _hyper_1_0_replica.series_0, _hyper_1_0_replica.series_1, _hyper_1_0_replica.series_2, _hyper_1_0_replica.series_bool
Filter: (('dev20'::text = _hyper_1_0_replica.device_id) AND ((((_sysinternal.murmur3_hash_string(_hyper_1_0_replica.device_id, 1) & 2147483647) % 32768))::smallint = '28646'::smallint))
-> Seq Scan on "testNs"._hyper_1_2_0_partition
-> Seq Scan on _sysinternal._hyper_1_2_0_partition
Output: _hyper_1_2_0_partition."timeCustom", _hyper_1_2_0_partition.device_id, _hyper_1_2_0_partition.series_0, _hyper_1_2_0_partition.series_1, _hyper_1_2_0_partition.series_2, _hyper_1_2_0_partition.series_bool
Filter: (('dev20'::text = _hyper_1_2_0_partition.device_id) AND ((((_sysinternal.murmur3_hash_string(_hyper_1_2_0_partition.device_id, 1) & 2147483647) % 32768))::smallint = '28646'::smallint))
-> Bitmap Heap Scan on "testNs"._hyper_1_2_0_3_data
-> Bitmap Heap Scan on _sysinternal._hyper_1_2_0_3_data
Output: _hyper_1_2_0_3_data."timeCustom", _hyper_1_2_0_3_data.device_id, _hyper_1_2_0_3_data.series_0, _hyper_1_2_0_3_data.series_1, _hyper_1_2_0_3_data.series_2, _hyper_1_2_0_3_data.series_bool
Recheck Cond: ('dev20'::text = _hyper_1_2_0_3_data.device_id)
Filter: ((((_sysinternal.murmur3_hash_string(_hyper_1_2_0_3_data.device_id, 1) & 2147483647) % 32768))::smallint = '28646'::smallint)

View File

@ -25,7 +25,7 @@ CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_1) WHERE
CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL;
CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL;
SELECT * FROM create_hypertable('"public"."testNs"', 'timeCustom', 'device_id', hypertable_name=>'testNs', associated_schema_name=>'testNs' );
SELECT * FROM create_hypertable('"public"."testNs"', 'timeCustom', 'device_id', hypertable_name=>'testNs', associated_schema_name=>'_sysinternal' );
SELECT set_is_distinct_flag('"public"."testNs"', 'device_id', TRUE);

View File

@ -3,13 +3,12 @@
\set ECHO ALL
\ir include/insert.sql
\c Test1
\d+ "testNs".*
\d+ "_sysinternal".*
\c test2
\d+ "testNs".*
\d+ "_sysinternal".*
SELECT *
FROM "testNs"._hyper_1_0_replica;
FROM "_sysinternal"._hyper_1_0_replica;
SELECT *
FROM "testNs"._hyper_1_0_distinct;
FROM "_sysinternal"._hyper_1_0_distinct;

View File

@ -30,4 +30,6 @@ golden_test ioql_query.sql ioql_query.out
golden_test sql_query.sql sql_query.out
golden_test ddl.sql ddl.out
golden_test timestamp.sql timestamp.out
golden_test drop_hypertable.sql drop_hypertable.out
echo "Success"

View File

@ -1,4 +1,4 @@
CREATE OR REPLACE FUNCTION unit_tests.test_unknown_hyper_table()
CREATE OR REPLACE FUNCTION unit_tests.test_unknown_hypertable()
RETURNS test_result
AS
$$