Finishing refactor TODOs & Formatting. Placement and cross-epoch queries.

This commit is contained in:
Matvey Arye 2016-11-21 15:07:12 -05:00
parent 939a4008ad
commit 3c72689664
12 changed files with 437 additions and 342 deletions

View File

@ -31,16 +31,17 @@ CREATE TABLE IF NOT EXISTS cluster_user (
-- ii) root table is the ancesstor of all the data tables (across replicas). Should not be queryable for data (TODO).
-- iii) distinct root table is the ancestor of all distinct tables (across replicas). Should not be queryable for data (TODO).
CREATE TABLE IF NOT EXISTS hypertable (
name NAME NOT NULL PRIMARY KEY CHECK (name NOT LIKE '\_%'),
main_schema_name NAME NOT NULL,
main_table_name NAME NOT NULL,
associated_schema_name NAME NOT NULL,
associated_table_prefix NAME NOT NULL,
root_schema_name NAME NOT NULL,
root_table_name NAME NOT NULL,
distinct_schema_name NAME NOT NULL,
distinct_table_name NAME NOT NULL,
replication_factor SMALLINT NOT NULL CHECK (replication_factor > 0),
name NAME NOT NULL PRIMARY KEY CHECK (name NOT LIKE '\_%'),
main_schema_name NAME NOT NULL,
main_table_name NAME NOT NULL,
associated_schema_name NAME NOT NULL,
associated_table_prefix NAME NOT NULL,
root_schema_name NAME NOT NULL,
root_table_name NAME NOT NULL,
distinct_schema_name NAME NOT NULL,
distinct_table_name NAME NOT NULL,
replication_factor SMALLINT NOT NULL CHECK (replication_factor > 0),
placement chunk_placement_type NOT NULL,
UNIQUE (main_schema_name, main_table_name),
UNIQUE (associated_schema_name, associated_table_prefix),
UNIQUE (root_schema_name, root_table_name)
@ -124,6 +125,7 @@ CREATE TABLE IF NOT EXISTS partition_replica (
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)
);

View File

@ -8,3 +8,14 @@ BEGIN
END IF;
END
$BODY$;
DO
$BODY$
BEGIN
IF NOT EXISTS(SELECT 1
FROM pg_type
WHERE typname = 'chunk_placement_type') THEN
CREATE TYPE chunk_placement_type AS ENUM ('RANDOM', 'STICKY');
END IF;
END
$BODY$;

View File

@ -1,4 +1,4 @@
CREATE OR REPLACE FUNCTION lock_for_chunk_close(
CREATE OR REPLACE FUNCTION _sysinternal.lock_for_chunk_close(
chunk_id INTEGER
)
RETURNS VOID LANGUAGE PLPGSQL VOLATILE AS
@ -15,7 +15,7 @@ END
$BODY$;
CREATE OR REPLACE FUNCTION max_time_for_chunk_close(
CREATE OR REPLACE FUNCTION _sysinternal.max_time_for_chunk_close(
schema_name NAME,
table_name NAME
)
@ -36,7 +36,7 @@ BEGIN
END
$BODY$;
CREATE OR REPLACE FUNCTION set_end_time_for_chunk_close(
CREATE OR REPLACE FUNCTION _sysinternal.set_end_time_for_chunk_close(
chunk_id INTEGER,
max_time BIGINT
)
@ -70,8 +70,6 @@ BEGIN
INTO STRICT meta_row
FROM meta;
RAISE WARNING 'testing % %', partition_id, time_point;
SELECT t.*
INTO chunk_row
FROM dblink(meta_row.server_name,

View File

@ -3,27 +3,32 @@ CREATE OR REPLACE FUNCTION ioql_exec_query_record_sql(query ioql_query)
$BODY$
DECLARE
sql_code TEXT;
epoch partition_epoch;
BEGIN
--TODO : broken; assumes one partition_epoch. Needs to be a loop.
SELECT *
INTO epoch
FROM partition_epoch pe
WHERE pe.hypertable_name = query.namespace_name;
--TODO : cross-epoch queries can be optimized much more than a simple limit.
SELECT format(
$$ SELECT *
FROM (%s) AS union_epoch
LIMIT %L
$$,
string_agg('('||code_epoch.code||')', ' UNION ALL '),
query.limit_rows)
INTO sql_code
FROM (
SELECT CASE WHEN NOT query.aggregate IS NULL THEN
ioql_query_agg_sql(query, pe)
ELSE
ioql_query_nonagg_sql(query, pe)
END AS code
FROM partition_epoch pe
WHERE pe.hypertable_name = query.namespace_name
) AS code_epoch;
IF epoch IS NULL THEN
IF NOT FOUND THEN
RETURN format($$ SELECT * FROM no_cluster_table(%L) $$, _query);
END IF;
IF NOT query.aggregate IS NULL THEN
sql_code := ioql_query_agg_sql(query, epoch);
RAISE NOTICE E'Cross-node SQL:\n%\n', sql_code;
RETURN sql_code;
ELSE
sql_code := ioql_query_nonagg_sql(query, epoch);
RAISE NOTICE E'Cross-node SQL:\n%\n', sql_code;
RETURN sql_code;
END IF;
RAISE NOTICE E'Cross-node SQL:\n%\n', sql_code;
RETURN sql_code;
END
$BODY$;

View File

@ -3,11 +3,11 @@ CREATE OR REPLACE FUNCTION ioql_query_nonagg_without_limit_sql(query ioql_query,
--function aggregates partials across nodes.
BEGIN
--todo: the order by and limit can be removed?
RETURN FORMAT(
RETURN format(
$$
SELECT *
FROM ioql_exec_query_nodes(
%2$L, %5$L, %1$L
%2$L, %5$L, %1$L
) as res(%1$s)
ORDER BY time DESC NULLS LAST
%4$s
@ -66,6 +66,3 @@ BEGIN
END IF;
END;
$BODY$;

View File

@ -190,7 +190,7 @@ BEGIN
epoch_row.partitioning_func, epoch_row.partitioning_field,
epoch_row.partitioning_mod, keyspace_start, keyspace_end);
EXECUTE FORMAT(
EXECUTE format(
$$
CREATE INDEX %3$I ON %1$I.%2$I ("time" DESC NULLS LAST, %4$I)
$$,
@ -210,26 +210,26 @@ CREATE OR REPLACE FUNCTION _sysinternal.set_time_constraint(
$BODY$
DECLARE
BEGIN
EXECUTE FORMAT(
EXECUTE format(
$$
ALTER TABLE %I.%I DROP CONSTRAINT IF EXISTS time_range
$$,
schema_name, table_name);
IF start_time IS NOT NULL AND end_time IS NOT NULL THEN
EXECUTE FORMAT(
EXECUTE format(
$$
ALTER TABLE %I.%I ADD CONSTRAINT time_range CHECK(time >= %L AND time <= %L)
$$,
schema_name, table_name, start_time, end_time);
ELSIF start_time IS NOT NULL THEN
EXECUTE FORMAT(
EXECUTE format(
$$
ALTER TABLE %I.%I ADD CONSTRAINT time_range CHECK(time >= %L)
$$,
schema_name, table_name, start_time);
ELSIF end_time IS NOT NULL THEN
EXECUTE FORMAT(
EXECUTE format(
$$
ALTER TABLE %I.%I ADD CONSTRAINT time_range CHECK(time <= %L)
$$,

View File

@ -144,7 +144,7 @@ BEGIN
PERFORM dblink_connect(node_row.server_name, node_row.server_name);
PERFORM dblink_exec(node_row.server_name, 'BEGIN');
PERFORM 1
FROM dblink(node_row.server_name, format('SELECT * FROM lock_for_chunk_close(%L)',
FROM dblink(node_row.server_name, format('SELECT * FROM _sysinternal.lock_for_chunk_close(%L)',
chunk_id)) AS t(x TEXT);
END LOOP;
@ -160,7 +160,7 @@ BEGIN
SELECT t.max_time
INTO max_time_replica
FROM dblink(crn_node_row.server_name,
format('SELECT * FROM max_time_for_chunk_close(%L, %L)', crn_node_row.schema_name,
format('SELECT * FROM _sysinternal.max_time_for_chunk_close(%L, %L)', crn_node_row.schema_name,
crn_node_row.table_name)) AS t(max_time BIGINT);
IF max_time = 0 THEN
@ -187,7 +187,7 @@ BEGIN
LOOP
PERFORM 1
FROM dblink(node_row.server_name,
format('SELECT * FROM set_end_time_for_chunk_close(%L, %L)', chunk_id, table_end)) AS t(x TEXT);
format('SELECT * FROM _sysinternal.set_end_time_for_chunk_close(%L, %L)', chunk_id, table_end)) AS t(x TEXT);
PERFORM dblink_exec(node_row.server_name, 'COMMIT');
--TODO: should we disconnect here?
PERFORM dblink_disconnect(node_row.server_name);

View File

@ -1,3 +1,45 @@
CREATE OR REPLACE FUNCTION _sysinternal.place_chunks(chunk_row chunk, placement chunk_placement_type, replication_factor SMALLINT)
RETURNS TABLE(replica_id SMALLINT, database_name NAME) LANGUAGE PLPGSQL AS
$BODY$
DECLARE
BEGIN
PERFORM setseed(chunk_row.id::double precision/2147483647::double precision);
IF placement = 'RANDOM' THEN
RETURN QUERY
SELECT pr.replica_id, dn.database_name
FROM partition_replica pr
INNER JOIN (
SELECT *
FROM
(
SELECT DISTINCT n.database_name
FROM node n
LIMIT replication_factor
) AS d
ORDER BY random()
) AS dn ON TRUE
WHERE pr.partition_id = chunk_row.partition_id;
ELSIF placement = 'STICKY' THEN
RETURN QUERY
SELECT pr.replica_id, dn.database_name
FROM partition_replica pr
INNER JOIN LATERAL (
SELECT crn.database_name
FROM chunk_replica_node crn
INNER JOIN chunk c ON (c.id = crn.chunk_id)
WHERE crn.partition_replica_id = pr.id
ORDER BY GREATEST(chunk_row.start_time, chunk_row.end_time) - GREATEST(c.start_time, c.end_time) ASC NULLS LAST
LIMIT 1
) AS dn ON true
WHERE pr.partition_id = chunk_row.partition_id;
IF NOT FOUND THEN
RETURN query SELECT *
FROM _sysinternal.place_chunks(chunk_row, 'RANDOM', replication_factor);
END IF;
END IF;
END
$BODY$;
CREATE OR REPLACE FUNCTION _sysinternal.on_create_chunk()
RETURNS TRIGGER LANGUAGE PLPGSQL AS
$BODY$
@ -32,31 +74,27 @@ BEGIN
FROM node AS n
LOOP
EXECUTE format(
$$
$$
INSERT INTO %I.%I SELECT $1.*
$$,
schema_name,
TG_TABLE_NAME
schema_name,
TG_TABLE_NAME
)
USING NEW;
END LOOP;
--do not sync data on update. synced by close_chunk logic.
PERFORM setseed(NEW.id::double precision/ 2147483647::double precision);
--TODO: random node picking broken (should make sure replicas are on different nodes). also stickiness.
INSERT INTO chunk_replica_node (chunk_id, partition_replica_id, database_name, schema_name, table_name)
SELECT
NEW.id,
pr.id,
(SELECT database_name
FROM node
ORDER BY random()
LIMIT 1),
p.database_name,
pr.schema_name,
format('%s_%s_%s_%s_data', h.associated_table_prefix, pr.id, pr.replica_id, NEW.id)
FROM partition_replica pr
INNER JOIN hypertable h ON (h.name = pr.hypertable_name)
INNER JOIN _sysinternal.place_chunks(new, h.placement, h.replication_factor) p ON (p.replica_id = pr.replica_id)
WHERE pr.partition_id = NEW.partition_id;
END IF;

View File

@ -64,7 +64,8 @@ CREATE OR REPLACE FUNCTION add_hypertable(
associated_schema_name NAME = NULL,
associated_table_prefix NAME = NULL,
number_partitions SMALLINT = NULL,
replication_factor SMALLINT = 1
replication_factor SMALLINT = 1,
placement chunk_placement_type = 'STICKY'
)
RETURNS VOID LANGUAGE PLPGSQL VOLATILE AS
$BODY$
@ -94,14 +95,16 @@ BEGIN
associated_schema_name, associated_table_prefix,
root_schema_name, root_table_name,
distinct_schema_name, distinct_table_name,
replication_factor)
replication_factor,
placement)
VALUES (
hypertable_name,
main_schema_name, hypertable_name,
associated_schema_name, associated_table_prefix,
associated_schema_name, format('%s_root', associated_table_prefix),
associated_schema_name, format('%s_distinct', associated_table_prefix),
replication_factor)
replication_factor,
placement)
ON CONFLICT DO NOTHING;
IF number_partitions != 0 THEN

View File

@ -93,9 +93,9 @@ FROM meta;
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
--------+------------------+-----------------+------------------------+-------------------------+------------------+-----------------+----------------------+---------------------+--------------------
testNs | public | testNs | _sys_1_testNs | _hyper_1 | _sys_1_testNs | _hyper_1_root | _sys_1_testNs | _hyper_1_distinct | 1
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
--------+------------------+-----------------+------------------------+-------------------------+------------------+-----------------+----------------------+---------------------+--------------------+-----------
testNs | public | testNs | _sys_1_testNs | _hyper_1 | _sys_1_testNs | _hyper_1_root | _sys_1_testNs | _hyper_1_distinct | 1 | STICKY
(1 row)
SELECT *
@ -109,7 +109,7 @@ SELECT *
FROM distinct_replica_node;
hypertable_name | replica_id | database_name | schema_name | table_name
-----------------+------------+---------------+---------------+----------------------------
testNs | 0 | test2 | _sys_1_testNs | _hyper_1_0_2_distinct_data
testNs | 0 | Test1 | _sys_1_testNs | _hyper_1_0_1_distinct_data
(1 row)
SELECT *
@ -146,7 +146,7 @@ SELECT *
FROM chunk_replica_node;
chunk_id | partition_replica_id | database_name | schema_name | table_name
----------+----------------------+---------------+---------------+---------------------
1 | 1 | test2 | _sys_1_testNs | _hyper_1_1_0_1_data
1 | 1 | Test1 | _sys_1_testNs | _hyper_1_1_0_1_data
(1 row)
SELECT *
@ -196,9 +196,9 @@ FROM meta;
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
--------+------------------+-----------------+------------------------+-------------------------+------------------+-----------------+----------------------+---------------------+--------------------
testNs | public | testNs | _sys_1_testNs | _hyper_1 | _sys_1_testNs | _hyper_1_root | _sys_1_testNs | _hyper_1_distinct | 1
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
--------+------------------+-----------------+------------------------+-------------------------+------------------+-----------------+----------------------+---------------------+--------------------+-----------
testNs | public | testNs | _sys_1_testNs | _hyper_1 | _sys_1_testNs | _hyper_1_root | _sys_1_testNs | _hyper_1_distinct | 1 | STICKY
(1 row)
SELECT *
@ -212,7 +212,7 @@ SELECT *
FROM distinct_replica_node;
hypertable_name | replica_id | database_name | schema_name | table_name
-----------------+------------+---------------+---------------+----------------------------
testNs | 0 | test2 | _sys_1_testNs | _hyper_1_0_2_distinct_data
testNs | 0 | Test1 | _sys_1_testNs | _hyper_1_0_1_distinct_data
(1 row)
SELECT *
@ -249,7 +249,7 @@ SELECT *
FROM chunk_replica_node;
chunk_id | partition_replica_id | database_name | schema_name | table_name
----------+----------------------+---------------+---------------+---------------------
1 | 1 | test2 | _sys_1_testNs | _hyper_1_1_0_1_data
1 | 1 | Test1 | _sys_1_testNs | _hyper_1_1_0_1_data
(1 row)
SELECT *
@ -280,6 +280,13 @@ FROM field;
(2 rows)
\d+ "_sys_1_testNs".*
Index "_sys_1_testNs.1-time-Device_id"
Column | Type | Definition | Storage
-----------+--------+-------------+----------
time | bigint | "time" | plain
Device_id | text | "Device_id" | extended
btree, for table "_sys_1_testNs._hyper_1_1_0_1_data", predicate ("Device_id" IS NOT NULL)
Index "_sys_1_testNs.1_pidx"
Column | Type | Definition | Storage
-----------+--------+-------------+----------
@ -287,6 +294,13 @@ FROM field;
Device_id | text | "Device_id" | extended
btree, for table "_sys_1_testNs._hyper_1_1_0_partition"
Index "_sys_1_testNs.2-temp-time"
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)
Index "_sys_1_testNs.2_pidx"
Column | Type | Definition | Storage
-----------+--------+-------------+----------
@ -294,22 +308,43 @@ btree, for table "_sys_1_testNs._hyper_1_1_0_partition"
Device_id | text | "Device_id" | extended
btree, for table "_sys_1_testNs._hyper_1_2_0_partition"
Foreign table "_sys_1_testNs._hyper_1_0_2_distinct_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
--------+------+-----------+-------------+----------+--------------+-------------
field | text | not null | | extended | |
value | text | not null | | extended | |
Server: test2
FDW Options: (schema_name '_sys_1_testNs', table_name '_hyper_1_0_2_distinct_data')
Index "_sys_1_testNs.3-time-really_long_field_goes_on_and_on_and_on_and_on_and_on_an"
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)
Index "_sys_1_testNs.4-really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_"
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)
Table "_sys_1_testNs._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
Index "_sys_1_testNs._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"
Table "_sys_1_testNs._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_2_distinct_data
Child tables: "_sys_1_testNs"._hyper_1_0_1_distinct_data
Table "_sys_1_testNs._hyper_1_0_replica"
Column | Type | Modifiers | Storage | Stats target | Description
@ -324,19 +359,22 @@ 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
Foreign table "_sys_1_testNs._hyper_1_1_0_1_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+-------------+----------+--------------+-------------
time | bigint | not null | | plain | |
Device_id | text | | | extended | |
temp | double precision | | | plain | |
occupied | boolean | | | plain | |
latitude | bigint | | | plain | |
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | | | plain | |
Table "_sys_1_testNs._hyper_1_1_0_1_data"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
Device_id | text | | extended | |
temp | double precision | | plain | |
occupied | boolean | | plain | |
latitude | bigint | | plain | |
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | | plain | |
Indexes:
"1-time-Device_id" btree ("time" DESC NULLS LAST, "Device_id") WHERE "Device_id" IS NOT NULL
"2-temp-time" btree (temp, "time" DESC NULLS LAST) WHERE temp IS NOT NULL
"3-time-really_long_field_goes_on_and_on_and_on_and_on_and_on_an" 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
"4-really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_" btree (really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an, "time" DESC NULLS LAST) 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)
Server: test2
FDW Options: (schema_name '_sys_1_testNs', table_name '_hyper_1_1_0_1_data')
Inherits: "_sys_1_testNs"._hyper_1_1_0_partition
Table "_sys_1_testNs._hyper_1_1_0_partition"
@ -450,6 +488,13 @@ FROM get_or_create_chunk(1, 1257894000000000000 :: BIGINT);
\c Test1
\d+ "_sys_1_testNs".*
Index "_sys_1_testNs.1-time-Device_id"
Column | Type | Definition | Storage
-----------+--------+-------------+----------
time | bigint | "time" | plain
Device_id | text | "Device_id" | extended
btree, for table "_sys_1_testNs._hyper_1_1_0_1_data", predicate ("Device_id" IS NOT NULL)
Index "_sys_1_testNs.1_pidx"
Column | Type | Definition | Storage
-----------+--------+-------------+----------
@ -457,6 +502,13 @@ FROM get_or_create_chunk(1, 1257894000000000000 :: BIGINT);
Device_id | text | "Device_id" | extended
btree, for table "_sys_1_testNs._hyper_1_1_0_partition"
Index "_sys_1_testNs.2-temp-time"
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)
Index "_sys_1_testNs.2_pidx"
Column | Type | Definition | Storage
-----------+--------+-------------+----------
@ -464,6 +516,13 @@ btree, for table "_sys_1_testNs._hyper_1_1_0_partition"
Device_id | text | "Device_id" | extended
btree, for table "_sys_1_testNs._hyper_1_2_0_partition"
Index "_sys_1_testNs.3-time-really_long_field_goes_on_and_on_and_on_and_on_and_on_an"
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)
Index "_sys_1_testNs.3_pidx"
Column | Type | Definition | Storage
-----------+--------+-------------+----------
@ -471,6 +530,13 @@ btree, for table "_sys_1_testNs._hyper_1_2_0_partition"
Device_id | text | "Device_id" | extended
btree, for table "_sys_1_testNs._hyper_1_3_0_partition"
Index "_sys_1_testNs.4-really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_"
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)
Index "_sys_1_testNs.4_pidx"
Column | Type | Definition | Storage
-----------+--------+-------------+----------
@ -478,22 +544,29 @@ btree, for table "_sys_1_testNs._hyper_1_3_0_partition"
Device_id | text | "Device_id" | extended
btree, for table "_sys_1_testNs._hyper_1_4_0_partition"
Foreign table "_sys_1_testNs._hyper_1_0_2_distinct_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
--------+------+-----------+-------------+----------+--------------+-------------
field | text | not null | | extended | |
value | text | not null | | extended | |
Server: test2
FDW Options: (schema_name '_sys_1_testNs', table_name '_hyper_1_0_2_distinct_data')
Table "_sys_1_testNs._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
Index "_sys_1_testNs._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"
Table "_sys_1_testNs._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_2_distinct_data
Child tables: "_sys_1_testNs"._hyper_1_0_1_distinct_data
Table "_sys_1_testNs._hyper_1_0_replica"
Column | Type | Modifiers | Storage | Stats target | Description
@ -510,19 +583,22 @@ Child tables: "_sys_1_testNs"._hyper_1_1_0_partition,
"_sys_1_testNs"._hyper_1_3_0_partition,
"_sys_1_testNs"._hyper_1_4_0_partition
Foreign table "_sys_1_testNs._hyper_1_1_0_1_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+-------------+----------+--------------+-------------
time | bigint | not null | | plain | |
Device_id | text | | | extended | |
temp | double precision | | | plain | |
occupied | boolean | | | plain | |
latitude | bigint | | | plain | |
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | | | plain | |
Table "_sys_1_testNs._hyper_1_1_0_1_data"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
Device_id | text | | extended | |
temp | double precision | | plain | |
occupied | boolean | | plain | |
latitude | bigint | | plain | |
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | | plain | |
Indexes:
"1-time-Device_id" btree ("time" DESC NULLS LAST, "Device_id") WHERE "Device_id" IS NOT NULL
"2-temp-time" btree (temp, "time" DESC NULLS LAST) WHERE temp IS NOT NULL
"3-time-really_long_field_goes_on_and_on_and_on_and_on_and_on_an" 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
"4-really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_" btree (really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an, "time" DESC NULLS LAST) 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)
Server: test2
FDW Options: (schema_name '_sys_1_testNs', table_name '_hyper_1_1_0_1_data')
Inherits: "_sys_1_testNs"._hyper_1_1_0_partition
Table "_sys_1_testNs._hyper_1_1_0_partition"
@ -656,7 +732,7 @@ FROM chunk;
-----------+--------+-------------+----------
time | bigint | "time" | plain
Device_id | text | "Device_id" | extended
btree, for table "_sys_1_testNs._hyper_1_1_0_2_data", predicate ("Device_id" IS NOT NULL)
btree, for table "_sys_1_testNs._hyper_1_1_0_1_data", predicate ("Device_id" IS NOT NULL)
Index "_sys_1_testNs.1_pidx"
Column | Type | Definition | Storage
@ -670,7 +746,7 @@ btree, for table "_sys_1_testNs._hyper_1_1_0_partition"
--------+------------------+------------+---------
temp | double precision | temp | plain
time | bigint | "time" | plain
btree, for table "_sys_1_testNs._hyper_1_1_0_2_data", predicate (temp IS NOT NULL)
btree, for table "_sys_1_testNs._hyper_1_1_0_1_data", predicate (temp IS NOT NULL)
Index "_sys_1_testNs.2_pidx"
Column | Type | Definition | Storage
@ -684,7 +760,7 @@ btree, for table "_sys_1_testNs._hyper_1_2_0_partition"
-----------------------------------------------------------------+--------+-----------------------------------------------------------------+---------
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_2_data", predicate (really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an IS NOT NULL)
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)
Index "_sys_1_testNs.3_pidx"
Column | Type | Definition | Storage
@ -698,7 +774,7 @@ btree, for table "_sys_1_testNs._hyper_1_3_0_partition"
-----------------------------------------------------------------+--------+-----------------------------------------------------------------+---------
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_2_data", predicate (really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an IS NOT NULL)
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)
Index "_sys_1_testNs.4_pidx"
Column | Type | Definition | Storage
@ -707,6 +783,34 @@ btree, for table "_sys_1_testNs._hyper_1_1_0_2_data", predicate (really_long_fie
Device_id | text | "Device_id" | extended
btree, for table "_sys_1_testNs._hyper_1_4_0_partition"
Index "_sys_1_testNs.5-time-Device_id"
Column | Type | Definition | Storage
-----------+--------+-------------+----------
time | bigint | "time" | plain
Device_id | text | "Device_id" | extended
btree, for table "_sys_1_testNs._hyper_1_1_0_2_data", predicate ("Device_id" IS NOT NULL)
Index "_sys_1_testNs.6-temp-time"
Column | Type | Definition | Storage
--------+------------------+------------+---------
temp | double precision | temp | plain
time | bigint | "time" | plain
btree, for table "_sys_1_testNs._hyper_1_1_0_2_data", predicate (temp IS NOT NULL)
Index "_sys_1_testNs.7-time-really_long_field_goes_on_and_on_and_on_and_on_and_on_an"
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_2_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.8-really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_"
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_2_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"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
@ -723,23 +827,13 @@ Index "_sys_1_testNs._hyper_1_0_1_distinct_data_pkey"
value | text | value | extended
primary key, btree, for table "_sys_1_testNs._hyper_1_0_1_distinct_data"
Foreign table "_sys_1_testNs._hyper_1_0_2_distinct_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
--------+------+-----------+-------------+----------+--------------+-------------
field | text | not null | | extended | |
value | text | not null | | extended | |
Server: test2
FDW Options: (schema_name '_sys_1_testNs', table_name '_hyper_1_0_2_distinct_data')
Inherits: "_sys_1_testNs"._hyper_1_0_distinct
Table "_sys_1_testNs._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,
"_sys_1_testNs"._hyper_1_0_2_distinct_data
Child tables: "_sys_1_testNs"._hyper_1_0_1_distinct_data
Table "_sys_1_testNs._hyper_1_0_replica"
Column | Type | Modifiers | Storage | Stats target | Description
@ -756,23 +850,7 @@ Child tables: "_sys_1_testNs"._hyper_1_1_0_partition,
"_sys_1_testNs"._hyper_1_3_0_partition,
"_sys_1_testNs"._hyper_1_4_0_partition
Foreign table "_sys_1_testNs._hyper_1_1_0_1_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+-------------+----------+--------------+-------------
time | bigint | not null | | plain | |
Device_id | text | | | extended | |
temp | double precision | | | plain | |
occupied | boolean | | | plain | |
latitude | bigint | | | plain | |
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)
"time_range" CHECK ("time" <= '86399999999999'::bigint)
Server: test2
FDW Options: (schema_name '_sys_1_testNs', table_name '_hyper_1_1_0_1_data')
Inherits: "_sys_1_testNs"._hyper_1_1_0_partition
Table "_sys_1_testNs._hyper_1_1_0_2_data"
Table "_sys_1_testNs._hyper_1_1_0_1_data"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -786,6 +864,25 @@ Indexes:
"2-temp-time" btree (temp, "time" DESC NULLS LAST) WHERE temp IS NOT NULL
"3-time-really_long_field_goes_on_and_on_and_on_and_on_and_on_an" 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
"4-really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_" btree (really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an, "time" DESC NULLS LAST) 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)
"time_range" CHECK ("time" <= '86399999999999'::bigint)
Inherits: "_sys_1_testNs"._hyper_1_1_0_partition
Table "_sys_1_testNs._hyper_1_1_0_2_data"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------------------------------------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
Device_id | text | | extended | |
temp | double precision | | plain | |
occupied | boolean | | plain | |
latitude | bigint | | plain | |
really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an | bigint | | plain | |
Indexes:
"5-time-Device_id" btree ("time" DESC NULLS LAST, "Device_id") WHERE "Device_id" IS NOT NULL
"6-temp-time" btree (temp, "time" DESC NULLS LAST) WHERE temp IS NOT NULL
"7-time-really_long_field_goes_on_and_on_and_on_and_on_and_on_an" 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
"8-really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_" btree (really_long_field_goes_on_and_on_and_on_and_on_and_on_and_on_an, "time" DESC NULLS LAST) 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)
"time_range" CHECK ("time" >= '86400000000000'::bigint)

View File

@ -131,7 +131,14 @@ COMMIT;
-----------+--------+------------+----------
device_id | text | device_id | extended
time | bigint | "time" | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (device_id IS NOT NULL)
btree, for table "testNs._hyper_1_1_0_1_data", predicate (device_id IS NOT NULL)
Index "testNs.10-time-series_bool"
Column | Type | Definition | Storage
-------------+---------+-------------+---------
time | bigint | "time" | plain
series_bool | boolean | series_bool | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (series_bool IS NOT NULL)
Index "testNs.1_pidx"
Column | Type | Definition | Storage
@ -145,7 +152,7 @@ btree, for table "testNs._hyper_1_1_0_partition"
----------+------------------+------------+---------
time | bigint | "time" | 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 "testNs._hyper_1_1_0_1_data", predicate (series_0 IS NOT NULL)
Index "testNs.2_pidx"
Column | Type | Definition | Storage
@ -159,21 +166,49 @@ btree, for table "testNs._hyper_1_2_0_partition"
----------+------------------+------------+---------
time | bigint | "time" | 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 "testNs._hyper_1_1_0_1_data", predicate (series_1 IS NOT NULL)
Index "testNs.4-time-series_2"
Column | Type | Definition | Storage
----------+------------------+------------+---------
time | bigint | "time" | 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 "testNs._hyper_1_1_0_1_data", predicate (series_2 IS NOT NULL)
Index "testNs.5-time-series_bool"
Column | Type | Definition | Storage
-------------+---------+-------------+---------
time | bigint | "time" | 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 "testNs._hyper_1_1_0_1_data", predicate (series_bool IS NOT NULL)
Index "testNs.6-device_id-time"
Column | Type | Definition | Storage
-----------+--------+------------+----------
device_id | text | device_id | extended
time | bigint | "time" | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (device_id IS NOT NULL)
Index "testNs.7-time-series_0"
Column | Type | Definition | Storage
----------+------------------+------------+---------
time | bigint | "time" | plain
series_0 | double precision | series_0 | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (series_0 IS NOT NULL)
Index "testNs.8-time-series_1"
Column | Type | Definition | Storage
----------+------------------+------------+---------
time | bigint | "time" | plain
series_1 | double precision | series_1 | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (series_1 IS NOT NULL)
Index "testNs.9-time-series_2"
Column | Type | Definition | Storage
----------+------------------+------------+---------
time | bigint | "time" | plain
series_2 | double precision | series_2 | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (series_2 IS NOT NULL)
Table "testNs._hyper_1_0_1_distinct_data"
Column | Type | Modifiers | Storage | Stats target | Description
@ -191,23 +226,13 @@ Index "testNs._hyper_1_0_1_distinct_data_pkey"
value | text | value | extended
primary key, btree, for table "testNs._hyper_1_0_1_distinct_data"
Foreign table "testNs._hyper_1_0_2_distinct_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
--------+------+-----------+-------------+----------+--------------+-------------
field | text | not null | | extended | |
value | text | not null | | extended | |
Server: test2
FDW Options: (schema_name 'testNs', table_name '_hyper_1_0_2_distinct_data')
Inherits: "testNs"._hyper_1_0_distinct
Table "testNs._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,
"testNs"._hyper_1_0_2_distinct_data
Child tables: "testNs"._hyper_1_0_1_distinct_data
Table "testNs._hyper_1_0_replica"
Column | Type | Modifiers | Storage | Stats target | Description
@ -222,23 +247,7 @@ Inherits: "testNs"._hyper_1_root
Child tables: "testNs"._hyper_1_1_0_partition,
"testNs"._hyper_1_2_0_partition
Foreign table "testNs._hyper_1_1_0_1_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
-------------+------------------+-----------+-------------+----------+--------------+-------------
time | bigint | not null | | plain | |
device_id | text | | | 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)
"time_range" CHECK ("time" <= '1257983999999999999'::bigint)
Server: test2
FDW Options: (schema_name 'testNs', table_name '_hyper_1_1_0_1_data')
Inherits: "testNs"._hyper_1_1_0_partition
Table "testNs._hyper_1_1_0_2_data"
Table "testNs._hyper_1_1_0_1_data"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -253,6 +262,26 @@ Indexes:
"3-time-series_1" btree ("time" DESC NULLS LAST, series_1) WHERE series_1 IS NOT NULL
"4-time-series_2" btree ("time" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL
"5-time-series_bool" btree ("time" 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 ("time" <= '1257983999999999999'::bigint)
Inherits: "testNs"._hyper_1_1_0_partition
Table "testNs._hyper_1_1_0_2_data"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
device_id | text | | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Indexes:
"10-time-series_bool" btree ("time" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL
"6-device_id-time" btree (device_id, "time" DESC NULLS LAST) WHERE device_id IS NOT NULL
"7-time-series_0" btree ("time" DESC NULLS LAST, series_0) WHERE series_0 IS NOT NULL
"8-time-series_1" btree ("time" DESC NULLS LAST, series_1) WHERE series_1 IS NOT NULL
"9-time-series_2" btree ("time" 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 ("time" >= '1257984000000000000'::bigint)
@ -319,13 +348,6 @@ Child tables: "testNs"._hyper_1_0_replica
\c test2
\d+ "testNs".*
Index "testNs.1-device_id-time"
Column | Type | Definition | Storage
-----------+--------+------------+----------
device_id | text | device_id | extended
time | bigint | "time" | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (device_id IS NOT NULL)
Index "testNs.1_pidx"
Column | Type | Definition | Storage
-----------+--------+------------+----------
@ -333,13 +355,6 @@ btree, for table "testNs._hyper_1_1_0_1_data", predicate (device_id IS NOT NULL)
device_id | text | device_id | extended
btree, for table "testNs._hyper_1_1_0_partition"
Index "testNs.2-time-series_0"
Column | Type | Definition | Storage
----------+------------------+------------+---------
time | bigint | "time" | plain
series_0 | double precision | series_0 | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (series_0 IS NOT NULL)
Index "testNs.2_pidx"
Column | Type | Definition | Storage
-----------+--------+------------+----------
@ -347,27 +362,6 @@ btree, for table "testNs._hyper_1_1_0_1_data", predicate (series_0 IS NOT NULL)
device_id | text | device_id | extended
btree, for table "testNs._hyper_1_2_0_partition"
Index "testNs.3-time-series_1"
Column | Type | Definition | Storage
----------+------------------+------------+---------
time | bigint | "time" | plain
series_1 | double precision | series_1 | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (series_1 IS NOT NULL)
Index "testNs.4-time-series_2"
Column | Type | Definition | Storage
----------+------------------+------------+---------
time | bigint | "time" | plain
series_2 | double precision | series_2 | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (series_2 IS NOT NULL)
Index "testNs.5-time-series_bool"
Column | Type | Definition | Storage
-------------+---------+-------------+---------
time | bigint | "time" | plain
series_bool | boolean | series_bool | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (series_bool IS NOT NULL)
Foreign table "testNs._hyper_1_0_1_distinct_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
--------+------+-----------+-------------+----------+--------------+-------------
@ -377,30 +371,13 @@ Server: Test1
FDW Options: (schema_name 'testNs', table_name '_hyper_1_0_1_distinct_data')
Inherits: "testNs"._hyper_1_0_distinct
Table "testNs._hyper_1_0_2_distinct_data"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_1_0_2_distinct_data_pkey" PRIMARY KEY, btree (field, value)
Inherits: "testNs"._hyper_1_0_distinct
Index "testNs._hyper_1_0_2_distinct_data_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "testNs._hyper_1_0_2_distinct_data"
Table "testNs._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,
"testNs"._hyper_1_0_2_distinct_data
Child tables: "testNs"._hyper_1_0_1_distinct_data
Table "testNs._hyper_1_0_replica"
Column | Type | Modifiers | Storage | Stats target | Description
@ -415,24 +392,20 @@ Inherits: "testNs"._hyper_1_root
Child tables: "testNs"._hyper_1_1_0_partition,
"testNs"._hyper_1_2_0_partition
Table "testNs._hyper_1_1_0_1_data"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
device_id | text | | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Indexes:
"1-device_id-time" btree (device_id, "time" DESC NULLS LAST) WHERE device_id IS NOT NULL
"2-time-series_0" btree ("time" DESC NULLS LAST, series_0) WHERE series_0 IS NOT NULL
"3-time-series_1" btree ("time" DESC NULLS LAST, series_1) WHERE series_1 IS NOT NULL
"4-time-series_2" btree ("time" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL
"5-time-series_bool" btree ("time" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL
Foreign table "testNs._hyper_1_1_0_1_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
-------------+------------------+-----------+-------------+----------+--------------+-------------
time | bigint | not null | | plain | |
device_id | text | | | 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)
"time_range" CHECK ("time" <= '1257983999999999999'::bigint)
Server: Test1
FDW Options: (schema_name 'testNs', table_name '_hyper_1_1_0_1_data')
Inherits: "testNs"._hyper_1_1_0_partition
Foreign table "testNs._hyper_1_1_0_2_data"
@ -532,6 +505,5 @@ FROM "testNs"._hyper_1_0_distinct;
-----------+-------
device_id | dev1
device_id | dev2
device_id | dev1
(3 rows)
(2 rows)

View File

@ -131,7 +131,14 @@ COMMIT;
-----------+--------+------------+----------
device_id | text | device_id | extended
time | bigint | "time" | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (device_id IS NOT NULL)
btree, for table "testNs._hyper_1_1_0_1_data", predicate (device_id IS NOT NULL)
Index "testNs.10-time-series_bool"
Column | Type | Definition | Storage
-------------+---------+-------------+---------
time | bigint | "time" | plain
series_bool | boolean | series_bool | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (series_bool IS NOT NULL)
Index "testNs.1_pidx"
Column | Type | Definition | Storage
@ -145,7 +152,7 @@ btree, for table "testNs._hyper_1_1_0_partition"
----------+------------------+------------+---------
time | bigint | "time" | 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 "testNs._hyper_1_1_0_1_data", predicate (series_0 IS NOT NULL)
Index "testNs.2_pidx"
Column | Type | Definition | Storage
@ -159,21 +166,49 @@ btree, for table "testNs._hyper_1_2_0_partition"
----------+------------------+------------+---------
time | bigint | "time" | 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 "testNs._hyper_1_1_0_1_data", predicate (series_1 IS NOT NULL)
Index "testNs.4-time-series_2"
Column | Type | Definition | Storage
----------+------------------+------------+---------
time | bigint | "time" | 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 "testNs._hyper_1_1_0_1_data", predicate (series_2 IS NOT NULL)
Index "testNs.5-time-series_bool"
Column | Type | Definition | Storage
-------------+---------+-------------+---------
time | bigint | "time" | 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 "testNs._hyper_1_1_0_1_data", predicate (series_bool IS NOT NULL)
Index "testNs.6-device_id-time"
Column | Type | Definition | Storage
-----------+--------+------------+----------
device_id | text | device_id | extended
time | bigint | "time" | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (device_id IS NOT NULL)
Index "testNs.7-time-series_0"
Column | Type | Definition | Storage
----------+------------------+------------+---------
time | bigint | "time" | plain
series_0 | double precision | series_0 | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (series_0 IS NOT NULL)
Index "testNs.8-time-series_1"
Column | Type | Definition | Storage
----------+------------------+------------+---------
time | bigint | "time" | plain
series_1 | double precision | series_1 | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (series_1 IS NOT NULL)
Index "testNs.9-time-series_2"
Column | Type | Definition | Storage
----------+------------------+------------+---------
time | bigint | "time" | plain
series_2 | double precision | series_2 | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (series_2 IS NOT NULL)
Table "testNs._hyper_1_0_1_distinct_data"
Column | Type | Modifiers | Storage | Stats target | Description
@ -191,23 +226,13 @@ Index "testNs._hyper_1_0_1_distinct_data_pkey"
value | text | value | extended
primary key, btree, for table "testNs._hyper_1_0_1_distinct_data"
Foreign table "testNs._hyper_1_0_2_distinct_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
--------+------+-----------+-------------+----------+--------------+-------------
field | text | not null | | extended | |
value | text | not null | | extended | |
Server: test2
FDW Options: (schema_name 'testNs', table_name '_hyper_1_0_2_distinct_data')
Inherits: "testNs"._hyper_1_0_distinct
Table "testNs._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,
"testNs"._hyper_1_0_2_distinct_data
Child tables: "testNs"._hyper_1_0_1_distinct_data
Table "testNs._hyper_1_0_replica"
Column | Type | Modifiers | Storage | Stats target | Description
@ -222,23 +247,7 @@ Inherits: "testNs"._hyper_1_root
Child tables: "testNs"._hyper_1_1_0_partition,
"testNs"._hyper_1_2_0_partition
Foreign table "testNs._hyper_1_1_0_1_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
-------------+------------------+-----------+-------------+----------+--------------+-------------
time | bigint | not null | | plain | |
device_id | text | | | 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)
"time_range" CHECK ("time" <= '1257983999999999999'::bigint)
Server: test2
FDW Options: (schema_name 'testNs', table_name '_hyper_1_1_0_1_data')
Inherits: "testNs"._hyper_1_1_0_partition
Table "testNs._hyper_1_1_0_2_data"
Table "testNs._hyper_1_1_0_1_data"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
@ -253,6 +262,26 @@ Indexes:
"3-time-series_1" btree ("time" DESC NULLS LAST, series_1) WHERE series_1 IS NOT NULL
"4-time-series_2" btree ("time" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL
"5-time-series_bool" btree ("time" 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 ("time" <= '1257983999999999999'::bigint)
Inherits: "testNs"._hyper_1_1_0_partition
Table "testNs._hyper_1_1_0_2_data"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
device_id | text | | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Indexes:
"10-time-series_bool" btree ("time" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL
"6-device_id-time" btree (device_id, "time" DESC NULLS LAST) WHERE device_id IS NOT NULL
"7-time-series_0" btree ("time" DESC NULLS LAST, series_0) WHERE series_0 IS NOT NULL
"8-time-series_1" btree ("time" DESC NULLS LAST, series_1) WHERE series_1 IS NOT NULL
"9-time-series_2" btree ("time" 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 ("time" >= '1257984000000000000'::bigint)
@ -319,13 +348,6 @@ Child tables: "testNs"._hyper_1_0_replica
\c test2
\d+ "testNs".*
Index "testNs.1-device_id-time"
Column | Type | Definition | Storage
-----------+--------+------------+----------
device_id | text | device_id | extended
time | bigint | "time" | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (device_id IS NOT NULL)
Index "testNs.1_pidx"
Column | Type | Definition | Storage
-----------+--------+------------+----------
@ -333,13 +355,6 @@ btree, for table "testNs._hyper_1_1_0_1_data", predicate (device_id IS NOT NULL)
device_id | text | device_id | extended
btree, for table "testNs._hyper_1_1_0_partition"
Index "testNs.2-time-series_0"
Column | Type | Definition | Storage
----------+------------------+------------+---------
time | bigint | "time" | plain
series_0 | double precision | series_0 | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (series_0 IS NOT NULL)
Index "testNs.2_pidx"
Column | Type | Definition | Storage
-----------+--------+------------+----------
@ -347,27 +362,6 @@ btree, for table "testNs._hyper_1_1_0_1_data", predicate (series_0 IS NOT NULL)
device_id | text | device_id | extended
btree, for table "testNs._hyper_1_2_0_partition"
Index "testNs.3-time-series_1"
Column | Type | Definition | Storage
----------+------------------+------------+---------
time | bigint | "time" | plain
series_1 | double precision | series_1 | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (series_1 IS NOT NULL)
Index "testNs.4-time-series_2"
Column | Type | Definition | Storage
----------+------------------+------------+---------
time | bigint | "time" | plain
series_2 | double precision | series_2 | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (series_2 IS NOT NULL)
Index "testNs.5-time-series_bool"
Column | Type | Definition | Storage
-------------+---------+-------------+---------
time | bigint | "time" | plain
series_bool | boolean | series_bool | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (series_bool IS NOT NULL)
Foreign table "testNs._hyper_1_0_1_distinct_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
--------+------+-----------+-------------+----------+--------------+-------------
@ -377,30 +371,13 @@ Server: Test1
FDW Options: (schema_name 'testNs', table_name '_hyper_1_0_1_distinct_data')
Inherits: "testNs"._hyper_1_0_distinct
Table "testNs._hyper_1_0_2_distinct_data"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_1_0_2_distinct_data_pkey" PRIMARY KEY, btree (field, value)
Inherits: "testNs"._hyper_1_0_distinct
Index "testNs._hyper_1_0_2_distinct_data_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "testNs._hyper_1_0_2_distinct_data"
Table "testNs._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,
"testNs"._hyper_1_0_2_distinct_data
Child tables: "testNs"._hyper_1_0_1_distinct_data
Table "testNs._hyper_1_0_replica"
Column | Type | Modifiers | Storage | Stats target | Description
@ -415,24 +392,20 @@ Inherits: "testNs"._hyper_1_root
Child tables: "testNs"._hyper_1_1_0_partition,
"testNs"._hyper_1_2_0_partition
Table "testNs._hyper_1_1_0_1_data"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
time | bigint | not null | plain | |
device_id | text | | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Indexes:
"1-device_id-time" btree (device_id, "time" DESC NULLS LAST) WHERE device_id IS NOT NULL
"2-time-series_0" btree ("time" DESC NULLS LAST, series_0) WHERE series_0 IS NOT NULL
"3-time-series_1" btree ("time" DESC NULLS LAST, series_1) WHERE series_1 IS NOT NULL
"4-time-series_2" btree ("time" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL
"5-time-series_bool" btree ("time" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL
Foreign table "testNs._hyper_1_1_0_1_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
-------------+------------------+-----------+-------------+----------+--------------+-------------
time | bigint | not null | | plain | |
device_id | text | | | 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)
"time_range" CHECK ("time" <= '1257983999999999999'::bigint)
Server: Test1
FDW Options: (schema_name 'testNs', table_name '_hyper_1_1_0_1_data')
Inherits: "testNs"._hyper_1_1_0_partition
Foreign table "testNs._hyper_1_1_0_2_data"
@ -532,8 +505,7 @@ FROM "testNs"._hyper_1_0_distinct;
-----------+-------
device_id | dev1
device_id | dev2
device_id | dev1
(3 rows)
(2 rows)
\c Test1
SELECT *