|
|
|
@ -0,0 +1,285 @@
|
|
|
|
|
CREATE SCHEMA local_table_join_vars;
|
|
|
|
|
SET search_path TO local_table_join_vars;
|
|
|
|
|
SET client_min_messages to ERROR;
|
|
|
|
|
SELECT master_add_node('localhost', :master_port, groupId => 0) AS coordinator_nodeid \gset
|
|
|
|
|
SET client_min_messages TO DEBUG1;
|
|
|
|
|
CREATE TABLE postgres_table (key int, value text, value_2 jsonb);
|
|
|
|
|
CREATE TABLE reference_table (key int, value text, value_2 jsonb);
|
|
|
|
|
SELECT create_reference_table('reference_table');
|
|
|
|
|
create_reference_table
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
CREATE TABLE distributed_table (key int, value text, value_2 jsonb);
|
|
|
|
|
SELECT create_distributed_table('distributed_table', 'key');
|
|
|
|
|
create_distributed_table
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
CREATE TABLE distributed_table_pkey (key int primary key, value text, value_2 jsonb);
|
|
|
|
|
DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "distributed_table_pkey_pkey" for table "distributed_table_pkey"
|
|
|
|
|
SELECT create_distributed_table('distributed_table_pkey', 'key');
|
|
|
|
|
create_distributed_table
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
CREATE TABLE distributed_table_windex (key int primary key, value text, value_2 jsonb);
|
|
|
|
|
DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "distributed_table_windex_pkey" for table "distributed_table_windex"
|
|
|
|
|
SELECT create_distributed_table('distributed_table_windex', 'key');
|
|
|
|
|
create_distributed_table
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
CREATE UNIQUE INDEX key_index ON distributed_table_windex (key);
|
|
|
|
|
CREATE TABLE citus_local(key int, value text);
|
|
|
|
|
SELECT create_citus_local_table('citus_local');
|
|
|
|
|
create_citus_local_table
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
CREATE TABLE distributed_partitioned_table(key int, value text) PARTITION BY RANGE (key);
|
|
|
|
|
CREATE TABLE distributed_partitioned_table_1 PARTITION OF distributed_partitioned_table FOR VALUES FROM (0) TO (50);
|
|
|
|
|
CREATE TABLE distributed_partitioned_table_2 PARTITION OF distributed_partitioned_table FOR VALUES FROM (50) TO (200);
|
|
|
|
|
SELECT create_distributed_table('distributed_partitioned_table', 'key');
|
|
|
|
|
create_distributed_table
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
CREATE TABLE local_partitioned_table(key int, value text) PARTITION BY RANGE (key);
|
|
|
|
|
CREATE TABLE local_partitioned_table_1 PARTITION OF local_partitioned_table FOR VALUES FROM (0) TO (50);
|
|
|
|
|
CREATE TABLE local_partitioned_table_2 PARTITION OF local_partitioned_table FOR VALUES FROM (50) TO (200);
|
|
|
|
|
CREATE TABLE distributed_table_composite (key int, value text, value_2 jsonb, primary key (key, value));
|
|
|
|
|
DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "distributed_table_composite_pkey" for table "distributed_table_composite"
|
|
|
|
|
SELECT create_distributed_table('distributed_table_composite', 'key');
|
|
|
|
|
create_distributed_table
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
INSERT INTO postgres_table SELECT i, i::varchar(256) FROM generate_series(1, 100) i;
|
|
|
|
|
INSERT INTO reference_table SELECT i, i::varchar(256) FROM generate_series(1, 100) i;
|
|
|
|
|
DEBUG: distributed INSERT ... SELECT can only select from distributed tables
|
|
|
|
|
DEBUG: Collecting INSERT ... SELECT results on coordinator
|
|
|
|
|
INSERT INTO distributed_table_windex SELECT i, i::varchar(256) FROM generate_series(1, 100) i;
|
|
|
|
|
DEBUG: distributed INSERT ... SELECT can only select from distributed tables
|
|
|
|
|
DEBUG: Collecting INSERT ... SELECT results on coordinator
|
|
|
|
|
INSERT INTO distributed_table SELECT i, i::varchar(256) FROM generate_series(1, 100) i;
|
|
|
|
|
DEBUG: distributed INSERT ... SELECT can only select from distributed tables
|
|
|
|
|
DEBUG: Collecting INSERT ... SELECT results on coordinator
|
|
|
|
|
INSERT INTO distributed_table_pkey SELECT i, i::varchar(256) FROM generate_series(1, 100) i;
|
|
|
|
|
DEBUG: distributed INSERT ... SELECT can only select from distributed tables
|
|
|
|
|
DEBUG: Collecting INSERT ... SELECT results on coordinator
|
|
|
|
|
INSERT INTO distributed_partitioned_table SELECT i, i::varchar(256) FROM generate_series(1, 100) i;
|
|
|
|
|
DEBUG: distributed INSERT ... SELECT can only select from distributed tables
|
|
|
|
|
DEBUG: Collecting INSERT ... SELECT results on coordinator
|
|
|
|
|
INSERT INTO distributed_table_composite SELECT i, i::varchar(256) FROM generate_series(1, 100) i;
|
|
|
|
|
DEBUG: distributed INSERT ... SELECT can only select from distributed tables
|
|
|
|
|
DEBUG: Collecting INSERT ... SELECT results on coordinator
|
|
|
|
|
INSERT INTO local_partitioned_table SELECT i, i::varchar(256) FROM generate_series(1, 100) i;
|
|
|
|
|
-- vars referencing outer queries should work in SELECT
|
|
|
|
|
SELECT (SELECT COUNT(*) FROM postgres_table WHERE postgres_table.key = distributed_table.key) FROM distributed_table ORDER BY 1 LIMIT 1;
|
|
|
|
|
DEBUG: Wrapping relation "postgres_table" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join_vars.postgres_table WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT (SELECT count(*) AS count FROM (SELECT postgres_table_1.key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) postgres_table_1) postgres_table WHERE (postgres_table.key OPERATOR(pg_catalog.=) distributed_table.key)) AS count FROM local_table_join_vars.distributed_table ORDER BY (SELECT count(*) AS count FROM (SELECT postgres_table_1.key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) postgres_table_1) postgres_table WHERE (postgres_table.key OPERATOR(pg_catalog.=) distributed_table.key)) LIMIT 1
|
|
|
|
|
DEBUG: push down of limit count: 1
|
|
|
|
|
count
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
1
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
SELECT (SELECT COUNT(*) FROM postgres_table WHERE distributed_table.key = 5) FROM distributed_table ORDER BY 1 LIMIT 1;
|
|
|
|
|
DEBUG: Wrapping relation "postgres_table" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT NULL::integer AS "dummy-1" FROM local_table_join_vars.postgres_table WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT (SELECT count(*) AS count FROM (SELECT NULL::integer AS key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result."dummy-1" FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result("dummy-1" integer)) postgres_table_1) postgres_table WHERE (distributed_table.key OPERATOR(pg_catalog.=) 5)) AS count FROM local_table_join_vars.distributed_table ORDER BY (SELECT count(*) AS count FROM (SELECT NULL::integer AS key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result."dummy-1" FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result("dummy-1" integer)) postgres_table_1) postgres_table WHERE (distributed_table.key OPERATOR(pg_catalog.=) 5)) LIMIT 1
|
|
|
|
|
DEBUG: push down of limit count: 1
|
|
|
|
|
count
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
0
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
SELECT (SELECT COUNT(*) FROM distributed_table WHERE postgres_table.key = 5) FROM postgres_table ORDER BY 1 LIMIT 1;
|
|
|
|
|
DEBUG: Wrapping relation "distributed_table" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT NULL::integer AS "dummy-1" FROM local_table_join_vars.distributed_table WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT (SELECT count(*) AS count FROM (SELECT NULL::integer AS key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result."dummy-1" FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result("dummy-1" integer)) distributed_table_1) distributed_table WHERE (postgres_table.key OPERATOR(pg_catalog.=) 5)) AS count FROM local_table_join_vars.postgres_table ORDER BY (SELECT count(*) AS count FROM (SELECT NULL::integer AS key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result."dummy-1" FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result("dummy-1" integer)) distributed_table_1) distributed_table WHERE (postgres_table.key OPERATOR(pg_catalog.=) 5)) LIMIT 1
|
|
|
|
|
count
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
0
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
SELECT (SELECT COUNT(*) FROM distributed_table WHERE postgres_table.key = distributed_table.key) FROM postgres_table ORDER BY 1 LIMIT 1;
|
|
|
|
|
DEBUG: Wrapping relation "distributed_table" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join_vars.distributed_table WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT (SELECT count(*) AS count FROM (SELECT distributed_table_1.key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) distributed_table_1) distributed_table WHERE (postgres_table.key OPERATOR(pg_catalog.=) distributed_table.key)) AS count FROM local_table_join_vars.postgres_table ORDER BY (SELECT count(*) AS count FROM (SELECT distributed_table_1.key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) distributed_table_1) distributed_table WHERE (postgres_table.key OPERATOR(pg_catalog.=) distributed_table.key)) LIMIT 1
|
|
|
|
|
count
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
1
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
-- vars referencing outer queries should work in SELECT with citus local tables
|
|
|
|
|
SELECT (SELECT COUNT(*) FROM citus_local WHERE citus_local.key = distributed_table.key) FROM distributed_table ORDER BY 1 LIMIT 1;
|
|
|
|
|
DEBUG: Wrapping relation "citus_local" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join_vars.citus_local WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT (SELECT count(*) AS count FROM (SELECT citus_local_1.key, NULL::text AS value FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) citus_local_1) citus_local WHERE (citus_local.key OPERATOR(pg_catalog.=) distributed_table.key)) AS count FROM local_table_join_vars.distributed_table ORDER BY (SELECT count(*) AS count FROM (SELECT citus_local_1.key, NULL::text AS value FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) citus_local_1) citus_local WHERE (citus_local.key OPERATOR(pg_catalog.=) distributed_table.key)) LIMIT 1
|
|
|
|
|
DEBUG: push down of limit count: 1
|
|
|
|
|
count
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
0
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
SELECT (SELECT COUNT(*) FROM citus_local WHERE distributed_table.key = 5) FROM distributed_table ORDER BY 1 LIMIT 1;
|
|
|
|
|
DEBUG: Wrapping relation "citus_local" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT NULL::integer AS "dummy-1" FROM local_table_join_vars.citus_local WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT (SELECT count(*) AS count FROM (SELECT NULL::integer AS key, NULL::text AS value FROM (SELECT intermediate_result."dummy-1" FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result("dummy-1" integer)) citus_local_1) citus_local WHERE (distributed_table.key OPERATOR(pg_catalog.=) 5)) AS count FROM local_table_join_vars.distributed_table ORDER BY (SELECT count(*) AS count FROM (SELECT NULL::integer AS key, NULL::text AS value FROM (SELECT intermediate_result."dummy-1" FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result("dummy-1" integer)) citus_local_1) citus_local WHERE (distributed_table.key OPERATOR(pg_catalog.=) 5)) LIMIT 1
|
|
|
|
|
DEBUG: push down of limit count: 1
|
|
|
|
|
count
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
0
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
SELECT (SELECT COUNT(*) FROM distributed_table WHERE citus_local.key = 5) FROM citus_local ORDER BY 1 LIMIT 1;
|
|
|
|
|
DEBUG: Wrapping relation "distributed_table" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT NULL::integer AS "dummy-1" FROM local_table_join_vars.distributed_table WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT (SELECT count(*) AS count FROM (SELECT NULL::integer AS key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result."dummy-1" FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result("dummy-1" integer)) distributed_table_1) distributed_table WHERE (citus_local.key OPERATOR(pg_catalog.=) 5)) AS count FROM local_table_join_vars.citus_local ORDER BY (SELECT count(*) AS count FROM (SELECT NULL::integer AS key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result."dummy-1" FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result("dummy-1" integer)) distributed_table_1) distributed_table WHERE (citus_local.key OPERATOR(pg_catalog.=) 5)) LIMIT 1
|
|
|
|
|
count
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
(0 rows)
|
|
|
|
|
|
|
|
|
|
SELECT (SELECT COUNT(*) FROM distributed_table WHERE citus_local.key = distributed_table.key) FROM citus_local ORDER BY 1 LIMIT 1;
|
|
|
|
|
DEBUG: Wrapping relation "distributed_table" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join_vars.distributed_table WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT (SELECT count(*) AS count FROM (SELECT distributed_table_1.key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) distributed_table_1) distributed_table WHERE (citus_local.key OPERATOR(pg_catalog.=) distributed_table.key)) AS count FROM local_table_join_vars.citus_local ORDER BY (SELECT count(*) AS count FROM (SELECT distributed_table_1.key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) distributed_table_1) distributed_table WHERE (citus_local.key OPERATOR(pg_catalog.=) distributed_table.key)) LIMIT 1
|
|
|
|
|
count
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
(0 rows)
|
|
|
|
|
|
|
|
|
|
-- vars referencing outer queries should work in WHERE
|
|
|
|
|
SELECT COUNT(*) FROM distributed_table WHERE key in (SELECT key FROM postgres_table WHERE key > distributed_table.key);
|
|
|
|
|
DEBUG: Wrapping relation "postgres_table" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join_vars.postgres_table WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM local_table_join_vars.distributed_table WHERE (key OPERATOR(pg_catalog.=) ANY (SELECT postgres_table.key FROM (SELECT postgres_table_1.key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) postgres_table_1) postgres_table WHERE (postgres_table.key OPERATOR(pg_catalog.>) distributed_table.key)))
|
|
|
|
|
count
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
0
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
SELECT COUNT(*) FROM postgres_table WHERE key in (SELECT key FROM distributed_table WHERE key > postgres_table.key);
|
|
|
|
|
DEBUG: Wrapping relation "distributed_table" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join_vars.distributed_table WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM local_table_join_vars.postgres_table WHERE (key OPERATOR(pg_catalog.=) ANY (SELECT distributed_table.key FROM (SELECT distributed_table_1.key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) distributed_table_1) distributed_table WHERE (distributed_table.key OPERATOR(pg_catalog.>) postgres_table.key)))
|
|
|
|
|
count
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
0
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
SELECT COUNT(*) FROM postgres_table WHERE key in (SELECT key FROM distributed_table WHERE postgres_table.key > 5);
|
|
|
|
|
DEBUG: Wrapping relation "distributed_table" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join_vars.distributed_table WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM local_table_join_vars.postgres_table WHERE (key OPERATOR(pg_catalog.=) ANY (SELECT distributed_table.key FROM (SELECT distributed_table_1.key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) distributed_table_1) distributed_table WHERE (postgres_table.key OPERATOR(pg_catalog.>) 5)))
|
|
|
|
|
count
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
95
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
SELECT COUNT(*) FROM distributed_table WHERE key in (SELECT key FROM postgres_table WHERE distributed_table.key > 5);
|
|
|
|
|
DEBUG: Wrapping relation "postgres_table" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join_vars.postgres_table WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM local_table_join_vars.distributed_table WHERE (key OPERATOR(pg_catalog.=) ANY (SELECT postgres_table.key FROM (SELECT postgres_table_1.key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) postgres_table_1) postgres_table WHERE (distributed_table.key OPERATOR(pg_catalog.>) 5)))
|
|
|
|
|
count
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
95
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
-- vars referencing outer queries should work in WHERE with citus local tables
|
|
|
|
|
SELECT COUNT(*) FROM distributed_table WHERE key in (SELECT key FROM citus_local WHERE key > distributed_table.key);
|
|
|
|
|
DEBUG: Wrapping relation "citus_local" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join_vars.citus_local WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM local_table_join_vars.distributed_table WHERE (key OPERATOR(pg_catalog.=) ANY (SELECT citus_local.key FROM (SELECT citus_local_1.key, NULL::text AS value FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) citus_local_1) citus_local WHERE (citus_local.key OPERATOR(pg_catalog.>) distributed_table.key)))
|
|
|
|
|
count
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
0
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
SELECT COUNT(*) FROM citus_local WHERE key in (SELECT key FROM distributed_table WHERE key > citus_local.key);
|
|
|
|
|
DEBUG: Wrapping relation "distributed_table" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join_vars.distributed_table WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM local_table_join_vars.citus_local WHERE (key OPERATOR(pg_catalog.=) ANY (SELECT distributed_table.key FROM (SELECT distributed_table_1.key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) distributed_table_1) distributed_table WHERE (distributed_table.key OPERATOR(pg_catalog.>) citus_local.key)))
|
|
|
|
|
count
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
0
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
SELECT COUNT(*) FROM citus_local WHERE key in (SELECT key FROM distributed_table WHERE citus_local.key > 5);
|
|
|
|
|
DEBUG: Wrapping relation "distributed_table" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join_vars.distributed_table WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM local_table_join_vars.citus_local WHERE (key OPERATOR(pg_catalog.=) ANY (SELECT distributed_table.key FROM (SELECT distributed_table_1.key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) distributed_table_1) distributed_table WHERE (citus_local.key OPERATOR(pg_catalog.>) 5)))
|
|
|
|
|
count
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
0
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
SELECT COUNT(*) FROM distributed_table WHERE key in (SELECT key FROM citus_local WHERE distributed_table.key > 5);
|
|
|
|
|
DEBUG: Wrapping relation "citus_local" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join_vars.citus_local WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM local_table_join_vars.distributed_table WHERE (key OPERATOR(pg_catalog.=) ANY (SELECT citus_local.key FROM (SELECT citus_local_1.key, NULL::text AS value FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) citus_local_1) citus_local WHERE (distributed_table.key OPERATOR(pg_catalog.>) 5)))
|
|
|
|
|
count
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
0
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
-- citus-local, local and dist should work
|
|
|
|
|
SELECT COUNT(*) FROM distributed_table WHERE key in (SELECT key FROM citus_local JOIN postgres_table USING(key) WHERE key > distributed_table.key);
|
|
|
|
|
DEBUG: Wrapping relation "citus_local" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join_vars.citus_local WHERE true
|
|
|
|
|
DEBUG: Wrapping relation "postgres_table" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_2 for subquery SELECT key FROM local_table_join_vars.postgres_table WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM local_table_join_vars.distributed_table WHERE (key OPERATOR(pg_catalog.=) ANY (SELECT citus_local.key FROM ((SELECT citus_local_1.key, NULL::text AS value FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) citus_local_1) citus_local JOIN (SELECT postgres_table_1.key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) postgres_table_1) postgres_table USING (key)) WHERE (citus_local.key OPERATOR(pg_catalog.>) distributed_table.key)))
|
|
|
|
|
count
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
0
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
-- Will work when we fix "correlated subqueries are not supported when the FROM clause contains a CTE or subquery"
|
|
|
|
|
SELECT COUNT(*) FROM citus_local WHERE key in (SELECT key FROM distributed_table JOIN postgres_table USING(key) WHERE key > citus_local.key);
|
|
|
|
|
DEBUG: Wrapping relation "postgres_table" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join_vars.postgres_table WHERE true
|
|
|
|
|
DEBUG: Wrapping relation "citus_local" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_2 for subquery SELECT key FROM local_table_join_vars.citus_local WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT citus_local_1.key, NULL::text AS value FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) citus_local_1) citus_local WHERE (key OPERATOR(pg_catalog.=) ANY (SELECT distributed_table.key FROM (local_table_join_vars.distributed_table JOIN (SELECT postgres_table_1.key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) postgres_table_1) postgres_table USING (key)) WHERE (distributed_table.key OPERATOR(pg_catalog.>) citus_local.key)))
|
|
|
|
|
ERROR: correlated subqueries are not supported when the FROM clause contains a CTE or subquery
|
|
|
|
|
-- Will work when we fix "correlated subqueries are not supported when the FROM clause contains a CTE or subquery"
|
|
|
|
|
SELECT COUNT(*) FROM citus_local WHERE key in (SELECT key FROM distributed_table JOIN postgres_table USING(key) WHERE citus_local.key > 5);
|
|
|
|
|
DEBUG: Wrapping relation "postgres_table" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join_vars.postgres_table WHERE true
|
|
|
|
|
DEBUG: Wrapping relation "citus_local" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_2 for subquery SELECT key FROM local_table_join_vars.citus_local WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT citus_local_1.key, NULL::text AS value FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) citus_local_1) citus_local WHERE (key OPERATOR(pg_catalog.=) ANY (SELECT distributed_table.key FROM (local_table_join_vars.distributed_table JOIN (SELECT postgres_table_1.key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) postgres_table_1) postgres_table USING (key)) WHERE (citus_local.key OPERATOR(pg_catalog.>) 5)))
|
|
|
|
|
ERROR: correlated subqueries are not supported when the FROM clause contains a CTE or subquery
|
|
|
|
|
SELECT COUNT(*) FROM distributed_table WHERE key in (SELECT key FROM citus_local JOIN postgres_table USING(key) WHERE distributed_table.key > 5);
|
|
|
|
|
DEBUG: Wrapping relation "citus_local" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join_vars.citus_local WHERE true
|
|
|
|
|
DEBUG: Wrapping relation "postgres_table" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_2 for subquery SELECT key FROM local_table_join_vars.postgres_table WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM local_table_join_vars.distributed_table WHERE (key OPERATOR(pg_catalog.=) ANY (SELECT citus_local.key FROM ((SELECT citus_local_1.key, NULL::text AS value FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) citus_local_1) citus_local JOIN (SELECT postgres_table_1.key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) postgres_table_1) postgres_table USING (key)) WHERE (distributed_table.key OPERATOR(pg_catalog.>) 5)))
|
|
|
|
|
count
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
0
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
-- Will work when we fix "correlated subqueries are not supported when the FROM clause contains a CTE or subquery"
|
|
|
|
|
SELECT (SELECT (SELECT COUNT(*) FROM postgres_table WHERE postgres_table.key = distributed_table.key) FROM postgres_table p2) FROM distributed_table;
|
|
|
|
|
DEBUG: Wrapping relation "postgres_table" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM local_table_join_vars.postgres_table WHERE true
|
|
|
|
|
DEBUG: Wrapping relation "postgres_table" "p2" to a subquery
|
|
|
|
|
DEBUG: generating subplan XXX_2 for subquery SELECT NULL::integer AS "dummy-1" FROM local_table_join_vars.postgres_table p2 WHERE true
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT (SELECT (SELECT count(*) AS count FROM (SELECT postgres_table_1.key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) postgres_table_1) postgres_table WHERE (postgres_table.key OPERATOR(pg_catalog.=) distributed_table.key)) AS count FROM (SELECT NULL::integer AS key, NULL::text AS value, NULL::jsonb AS value_2 FROM (SELECT intermediate_result."dummy-1" FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result("dummy-1" integer)) p2_1) p2) AS count FROM local_table_join_vars.distributed_table
|
|
|
|
|
ERROR: correlated subqueries are not supported when the FROM clause contains a CTE or subquery
|
|
|
|
|
RESET client_min_messages;
|
|
|
|
|
\set VERBOSITY terse
|
|
|
|
|
DROP SCHEMA local_table_join_vars CASCADE;
|
|
|
|
|
NOTICE: drop cascades to 11 other objects
|