mirror of https://github.com/citusdata/citus.git
Work on tests
parent
4ef18e8737
commit
9275131730
|
@ -789,7 +789,6 @@ SELECT * FROM test ORDER BY id;
|
|||
|
||||
DROP TABLE test;
|
||||
-- verify that recreating distributed functions with TABLE params gets propagated to workers
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION func_with_return_table(int)
|
||||
RETURNS TABLE (date date)
|
||||
LANGUAGE plpgsql AS $$
|
||||
|
@ -797,14 +796,12 @@ BEGIN
|
|||
RETURN query SELECT '2011-01-01'::date;
|
||||
END;
|
||||
$$;
|
||||
RESET citus.enable_metadata_sync;
|
||||
SELECT create_distributed_function('func_with_return_table(int)');
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION func_with_return_table(int)
|
||||
RETURNS TABLE (date date)
|
||||
LANGUAGE plpgsql AS $$
|
||||
|
@ -812,7 +809,6 @@ BEGIN
|
|||
RETURN query SELECT '2011-01-02'::date;
|
||||
END;
|
||||
$$;
|
||||
RESET citus.enable_metadata_sync;
|
||||
SELECT count(*) FROM
|
||||
(SELECT result FROM
|
||||
run_command_on_workers($$select row(pg_proc.pronargs, pg_proc.proargtypes, pg_proc.prosrc) from pg_proc where proname = 'func_with_return_table';$$)
|
||||
|
@ -820,7 +816,7 @@ SELECT count(*) FROM
|
|||
as test;
|
||||
count
|
||||
---------------------------------------------------------------------
|
||||
2
|
||||
1
|
||||
(1 row)
|
||||
|
||||
-- verify that recreating distributed functions with OUT params gets propagated to workers
|
||||
|
|
|
@ -223,14 +223,15 @@ EXECUTE p1(6,6,6);
|
|||
DEBUG: Deferred pruning for a fast-path router query
|
||||
DEBUG: Creating router plan
|
||||
EXECUTE p1(7,7,7);
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE FUNCTION modify_fast_path_plpsql(int, int) RETURNS void as $$
|
||||
BEGIN
|
||||
DELETE FROM modify_fast_path WHERE key = $1 AND value_1 = $2;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A command for a distributed function is run. To make sure subsequent commands see the function correctly we need to make sure to use only one connection for all future commands
|
||||
SELECT modify_fast_path_plpsql(1,1);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
CONTEXT: SQL statement "DELETE FROM modify_fast_path WHERE key = $1 AND value_1 = $2"
|
||||
PL/pgSQL function modify_fast_path_plpsql(integer,integer) line XX at SQL statement
|
||||
|
@ -243,6 +244,7 @@ PL/pgSQL function modify_fast_path_plpsql(integer,integer) line XX at SQL statem
|
|||
(1 row)
|
||||
|
||||
SELECT modify_fast_path_plpsql(2,2);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
CONTEXT: SQL statement "DELETE FROM modify_fast_path WHERE key = $1 AND value_1 = $2"
|
||||
PL/pgSQL function modify_fast_path_plpsql(integer,integer) line XX at SQL statement
|
||||
|
@ -255,6 +257,7 @@ PL/pgSQL function modify_fast_path_plpsql(integer,integer) line XX at SQL statem
|
|||
(1 row)
|
||||
|
||||
SELECT modify_fast_path_plpsql(3,3);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
CONTEXT: SQL statement "DELETE FROM modify_fast_path WHERE key = $1 AND value_1 = $2"
|
||||
PL/pgSQL function modify_fast_path_plpsql(integer,integer) line XX at SQL statement
|
||||
|
@ -267,6 +270,7 @@ PL/pgSQL function modify_fast_path_plpsql(integer,integer) line XX at SQL statem
|
|||
(1 row)
|
||||
|
||||
SELECT modify_fast_path_plpsql(4,4);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
CONTEXT: SQL statement "DELETE FROM modify_fast_path WHERE key = $1 AND value_1 = $2"
|
||||
PL/pgSQL function modify_fast_path_plpsql(integer,integer) line XX at SQL statement
|
||||
|
@ -279,6 +283,7 @@ PL/pgSQL function modify_fast_path_plpsql(integer,integer) line XX at SQL statem
|
|||
(1 row)
|
||||
|
||||
SELECT modify_fast_path_plpsql(5,5);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
CONTEXT: SQL statement "DELETE FROM modify_fast_path WHERE key = $1 AND value_1 = $2"
|
||||
PL/pgSQL function modify_fast_path_plpsql(integer,integer) line XX at SQL statement
|
||||
|
@ -291,6 +296,7 @@ PL/pgSQL function modify_fast_path_plpsql(integer,integer) line XX at SQL statem
|
|||
(1 row)
|
||||
|
||||
SELECT modify_fast_path_plpsql(6,6);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
CONTEXT: SQL statement "DELETE FROM modify_fast_path WHERE key = $1 AND value_1 = $2"
|
||||
PL/pgSQL function modify_fast_path_plpsql(integer,integer) line XX at SQL statement
|
||||
|
@ -303,6 +309,7 @@ PL/pgSQL function modify_fast_path_plpsql(integer,integer) line XX at SQL statem
|
|||
(1 row)
|
||||
|
||||
SELECT modify_fast_path_plpsql(6,6);
|
||||
DEBUG: function does not have co-located tables
|
||||
modify_fast_path_plpsql
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -284,7 +284,6 @@ INSERT INTO test_nested VALUES (200,'twohundred');
|
|||
INSERT INTO test_nested VALUES (300,'threehundred');
|
||||
INSERT INTO test_nested VALUES (400,'fourhundred');
|
||||
INSERT INTO test_nested VALUES (512,'fivetwelve');
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION inner_force_delegation_function(int)
|
||||
RETURNS NUMERIC AS $$
|
||||
DECLARE ret_val NUMERIC;
|
||||
|
@ -294,7 +293,8 @@ BEGIN
|
|||
RETURN ret_val;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A command for a distributed function is run. To make sure subsequent commands see the function correctly we need to make sure to use only one connection for all future commands
|
||||
CREATE OR REPLACE FUNCTION func_calls_forcepush_func()
|
||||
RETURNS NUMERIC AS $$
|
||||
DECLARE incremented_val NUMERIC;
|
||||
|
@ -358,13 +358,14 @@ PL/pgSQL function func_calls_forcepush_func() line XX at SQL statement
|
|||
101
|
||||
(1 row)
|
||||
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION get_val()
|
||||
RETURNS INT AS $$
|
||||
BEGIN
|
||||
RETURN 100::INT;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A command for a distributed function is run. To make sure subsequent commands see the function correctly we need to make sure to use only one connection for all future commands
|
||||
--
|
||||
-- UDF calling another UDF in a FROM clause
|
||||
-- fn()
|
||||
|
@ -382,8 +383,13 @@ BEGIN
|
|||
RETURN incremented_val;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A command for a distributed function is run. To make sure subsequent commands see the function correctly we need to make sure to use only one connection for all future commands
|
||||
SELECT func_calls_forcepush_func_infrom();
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: not pushing down function calls in a multi-statement transaction
|
||||
CONTEXT: SQL statement "SELECT get_val()"
|
||||
PL/pgSQL function func_calls_forcepush_func_infrom() line XX at assignment
|
||||
DEBUG: pushing down function call in a multi-statement transaction
|
||||
CONTEXT: SQL statement "SELECT inner_force_delegation_function FROM inner_force_delegation_function(add_val + 100)"
|
||||
PL/pgSQL function func_calls_forcepush_func_infrom() line XX at SQL statement
|
||||
|
@ -401,6 +407,7 @@ PL/pgSQL function func_calls_forcepush_func_infrom() line XX at SQL statement
|
|||
|
||||
BEGIN;
|
||||
SELECT func_calls_forcepush_func_infrom();
|
||||
DEBUG: not pushing down function calls in a multi-statement transaction
|
||||
DEBUG: pushing down function call in a multi-statement transaction
|
||||
CONTEXT: SQL statement "SELECT inner_force_delegation_function FROM inner_force_delegation_function(add_val + 100)"
|
||||
PL/pgSQL function func_calls_forcepush_func_infrom() line XX at SQL statement
|
||||
|
@ -424,7 +431,6 @@ COMMIT;
|
|||
-- select fn() into var;
|
||||
-- }
|
||||
--
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION func_calls_forcepush_func_intarget()
|
||||
RETURNS NUMERIC AS $$
|
||||
DECLARE incremented_val NUMERIC;
|
||||
|
@ -435,8 +441,13 @@ BEGIN
|
|||
RETURN incremented_val;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A command for a distributed function is run. To make sure subsequent commands see the function correctly we need to make sure to use only one connection for all future commands
|
||||
SELECT func_calls_forcepush_func_intarget();
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: not pushing down function calls in a multi-statement transaction
|
||||
CONTEXT: SQL statement "SELECT get_val()"
|
||||
PL/pgSQL function func_calls_forcepush_func_intarget() line XX at assignment
|
||||
DEBUG: pushing down function call in a multi-statement transaction
|
||||
CONTEXT: SQL statement "SELECT inner_force_delegation_function(100 + 100) OFFSET 0"
|
||||
PL/pgSQL function func_calls_forcepush_func_intarget() line XX at SQL statement
|
||||
|
@ -454,6 +465,7 @@ PL/pgSQL function func_calls_forcepush_func_intarget() line XX at SQL statement
|
|||
|
||||
BEGIN;
|
||||
SELECT func_calls_forcepush_func_intarget();
|
||||
DEBUG: not pushing down function calls in a multi-statement transaction
|
||||
NOTICE: inner_force_delegation_function():201
|
||||
DETAIL: from localhost:xxxxx
|
||||
CONTEXT: SQL statement "SELECT inner_force_delegation_function(100 + 100) OFFSET 0"
|
||||
|
@ -624,7 +636,6 @@ END;
|
|||
$$ LANGUAGE plpgsql;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A command for a distributed function is run. To make sure subsequent commands see the function correctly we need to make sure to use only one connection for all future commands
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION outer_emp()
|
||||
RETURNS void
|
||||
AS $$
|
||||
|
@ -633,7 +644,8 @@ BEGIN
|
|||
PERFORM inner_emp('hello');
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A command for a distributed function is run. To make sure subsequent commands see the function correctly we need to make sure to use only one connection for all future commands
|
||||
SELECT create_distributed_function('inner_emp(text)','empname', force_delegation := true);
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A command for a distributed function is run. To make sure subsequent commands see the function correctly we need to make sure to use only one connection for all future commands
|
||||
|
@ -643,6 +655,7 @@ DETAIL: A command for a distributed function is run. To make sure subsequent co
|
|||
(1 row)
|
||||
|
||||
SELECT outer_emp();
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Skipping pushdown of function from a PL/PgSQL simple expression
|
||||
CONTEXT: SQL statement "SELECT inner_emp('hello')"
|
||||
PL/pgSQL function outer_emp() line XX at PERFORM
|
||||
|
@ -1251,7 +1264,6 @@ DETAIL: A command for a distributed function is run. To make sure subsequent co
|
|||
|
||||
DROP FUNCTION outer_test_prepare(int, int);
|
||||
ERROR: function outer_test_prepare(integer, integer) does not exist
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION outer_test_prepare(x int, y int)
|
||||
RETURNS void
|
||||
AS $$
|
||||
|
@ -1262,10 +1274,12 @@ BEGIN
|
|||
PERFORM 1, 1 + a FROM test_prepare(x + 1, y + 1) a;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A command for a distributed function is run. To make sure subsequent commands see the function correctly we need to make sure to use only one connection for all future commands
|
||||
-- First 5 get delegated and succeeds
|
||||
BEGIN;
|
||||
SELECT outer_test_prepare(1,1);
|
||||
DEBUG: not pushing down function calls in a multi-statement transaction
|
||||
DEBUG: pushing down function call in a multi-statement transaction
|
||||
CONTEXT: SQL statement "SELECT FROM test_prepare(x, y)"
|
||||
PL/pgSQL function outer_test_prepare(integer,integer) line XX at PERFORM
|
||||
|
@ -1284,6 +1298,7 @@ PL/pgSQL function outer_test_prepare(integer,integer) line XX at PERFORM
|
|||
(1 row)
|
||||
|
||||
SELECT outer_test_prepare(1,1);
|
||||
DEBUG: not pushing down function calls in a multi-statement transaction
|
||||
DEBUG: pushing down function call in a multi-statement transaction
|
||||
CONTEXT: SQL statement "SELECT FROM test_prepare(x, y)"
|
||||
PL/pgSQL function outer_test_prepare(integer,integer) line XX at PERFORM
|
||||
|
@ -1302,6 +1317,7 @@ PL/pgSQL function outer_test_prepare(integer,integer) line XX at PERFORM
|
|||
(1 row)
|
||||
|
||||
SELECT outer_test_prepare(1,1);
|
||||
DEBUG: not pushing down function calls in a multi-statement transaction
|
||||
DEBUG: pushing down function call in a multi-statement transaction
|
||||
CONTEXT: SQL statement "SELECT FROM test_prepare(x, y)"
|
||||
PL/pgSQL function outer_test_prepare(integer,integer) line XX at PERFORM
|
||||
|
@ -1320,6 +1336,7 @@ PL/pgSQL function outer_test_prepare(integer,integer) line XX at PERFORM
|
|||
(1 row)
|
||||
|
||||
SELECT outer_test_prepare(1,1);
|
||||
DEBUG: not pushing down function calls in a multi-statement transaction
|
||||
DEBUG: pushing down function call in a multi-statement transaction
|
||||
CONTEXT: SQL statement "SELECT FROM test_prepare(x, y)"
|
||||
PL/pgSQL function outer_test_prepare(integer,integer) line XX at PERFORM
|
||||
|
@ -1338,6 +1355,7 @@ PL/pgSQL function outer_test_prepare(integer,integer) line XX at PERFORM
|
|||
(1 row)
|
||||
|
||||
SELECT outer_test_prepare(1,1);
|
||||
DEBUG: not pushing down function calls in a multi-statement transaction
|
||||
DEBUG: pushing down function call in a multi-statement transaction
|
||||
CONTEXT: SQL statement "SELECT FROM test_prepare(x, y)"
|
||||
PL/pgSQL function outer_test_prepare(integer,integer) line XX at PERFORM
|
||||
|
@ -1364,6 +1382,7 @@ SELECT COUNT(*) FROM table_test_prepare;
|
|||
|
||||
-- 6th execution will be generic plan and should get delegated
|
||||
SELECT outer_test_prepare(1,1);
|
||||
DEBUG: not pushing down function calls in a multi-statement transaction
|
||||
DEBUG: pushing down function call in a multi-statement transaction
|
||||
CONTEXT: SQL statement "SELECT FROM test_prepare(x, y)"
|
||||
PL/pgSQL function outer_test_prepare(integer,integer) line XX at PERFORM
|
||||
|
@ -1382,6 +1401,7 @@ PL/pgSQL function outer_test_prepare(integer,integer) line XX at PERFORM
|
|||
(1 row)
|
||||
|
||||
SELECT outer_test_prepare(1,1);
|
||||
DEBUG: not pushing down function calls in a multi-statement transaction
|
||||
DEBUG: pushing down function call in a multi-statement transaction
|
||||
CONTEXT: SQL statement "SELECT FROM test_prepare(x, y)"
|
||||
PL/pgSQL function outer_test_prepare(integer,integer) line XX at PERFORM
|
||||
|
@ -1402,6 +1422,7 @@ PL/pgSQL function outer_test_prepare(integer,integer) line XX at PERFORM
|
|||
END;
|
||||
-- Fails as expected
|
||||
SELECT outer_test_prepare(1,2);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: pushing down function call in a multi-statement transaction
|
||||
CONTEXT: SQL statement "SELECT FROM test_prepare(x, y)"
|
||||
PL/pgSQL function outer_test_prepare(integer,integer) line XX at PERFORM
|
||||
|
|
|
@ -396,7 +396,6 @@ select colocate_proc_with_table('mx_call_func', 'mx_call_dist_table_1'::regclass
|
|||
(1 row)
|
||||
|
||||
-- Test table returning functions.
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE FUNCTION mx_call_func_tbl(x int)
|
||||
RETURNS TABLE (p0 int, p1 int)
|
||||
LANGUAGE plpgsql AS $$
|
||||
|
@ -410,9 +409,11 @@ BEGIN
|
|||
WHERE id >= x
|
||||
ORDER BY 1, 2;
|
||||
END;$$;
|
||||
RESET citus.enable_metadata_sync;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A command for a distributed function is run. To make sure subsequent commands see the function correctly we need to make sure to use only one connection for all future commands
|
||||
-- before distribution ...
|
||||
select mx_call_func_tbl(10);
|
||||
DEBUG: function does not have co-located tables
|
||||
mx_call_func_tbl
|
||||
---------------------------------------------------------------------
|
||||
(10,-1)
|
||||
|
|
|
@ -396,7 +396,6 @@ select colocate_proc_with_table('mx_call_func', 'mx_call_dist_table_1'::regclass
|
|||
(1 row)
|
||||
|
||||
-- Test table returning functions.
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE FUNCTION mx_call_func_tbl(x int)
|
||||
RETURNS TABLE (p0 int, p1 int)
|
||||
LANGUAGE plpgsql AS $$
|
||||
|
@ -410,9 +409,11 @@ BEGIN
|
|||
WHERE id >= x
|
||||
ORDER BY 1, 2;
|
||||
END;$$;
|
||||
RESET citus.enable_metadata_sync;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A command for a distributed function is run. To make sure subsequent commands see the function correctly we need to make sure to use only one connection for all future commands
|
||||
-- before distribution ...
|
||||
select mx_call_func_tbl(10);
|
||||
DEBUG: function does not have co-located tables
|
||||
mx_call_func_tbl
|
||||
---------------------------------------------------------------------
|
||||
(10,-1)
|
||||
|
|
|
@ -1584,7 +1584,6 @@ DEBUG: query has a single distribution column value: 1
|
|||
-- if these queries get routed, they would fail since number1() does not exist
|
||||
-- on workers. This tests an exceptional case in which some local tables bypass
|
||||
-- checks.
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION number1(OUT datid int)
|
||||
RETURNS SETOF int
|
||||
AS $$
|
||||
|
@ -1593,11 +1592,13 @@ BEGIN
|
|||
RETURN QUERY SELECT 1;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A command for a distributed function is run. To make sure subsequent commands see the function correctly we need to make sure to use only one connection for all future commands
|
||||
SELECT 1 FROM authors_reference r JOIN (
|
||||
SELECT s.datid FROM number1() s LEFT JOIN pg_database d ON s.datid = d.oid
|
||||
) num_db ON (r.id = num_db.datid) LIMIT 1;
|
||||
DEBUG: found no worker with all shard placements
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT datid FROM public.number1() s(datid)
|
||||
DEBUG: Creating router plan
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT s.datid FROM ((SELECT intermediate_result.datid FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(datid integer)) s LEFT JOIN pg_database d ON (((s.datid)::oid OPERATOR(pg_catalog.=) d.oid)))
|
||||
|
@ -1612,6 +1613,7 @@ CREATE VIEW num_db AS
|
|||
SELECT s.datid FROM number1() s LEFT JOIN pg_database d ON s.datid = d.oid;
|
||||
SELECT 1 FROM authors_reference r JOIN num_db ON (r.id = num_db.datid) LIMIT 1;
|
||||
DEBUG: found no worker with all shard placements
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT datid FROM public.number1() s(datid)
|
||||
DEBUG: Creating router plan
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT s.datid FROM ((SELECT intermediate_result.datid FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(datid integer)) s LEFT JOIN pg_database d ON (((s.datid)::oid OPERATOR(pg_catalog.=) d.oid)))
|
||||
|
@ -2301,7 +2303,6 @@ DEBUG: query has a single distribution column value: 1
|
|||
(5 rows)
|
||||
|
||||
-- queries inside plpgsql functions could be router plannable
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION author_articles_max_id() RETURNS int AS $$
|
||||
DECLARE
|
||||
max_id integer;
|
||||
|
@ -2312,7 +2313,10 @@ BEGIN
|
|||
return max_id;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A command for a distributed function is run. To make sure subsequent commands see the function correctly we need to make sure to use only one connection for all future commands
|
||||
SELECT author_articles_max_id();
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Creating router plan
|
||||
CONTEXT: SQL statement "SELECT MAX(id) FROM articles_hash ah
|
||||
WHERE author_id = 1"
|
||||
|
@ -2337,8 +2341,10 @@ BEGIN
|
|||
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A command for a distributed function is run. To make sure subsequent commands see the function correctly we need to make sure to use only one connection for all future commands
|
||||
SELECT * FROM author_articles_id_word_count() ORDER BY 1;
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Creating router plan
|
||||
CONTEXT: SQL statement "SELECT ah.id, ah.word_count
|
||||
FROM articles_hash ah
|
||||
|
|
|
@ -1603,7 +1603,6 @@ DEBUG: Deferred pruning for a fast-path router query
|
|||
DEBUG: Creating router plan
|
||||
EXECUTE author_articles_update(NULL);
|
||||
-- queries inside plpgsql functions could be router plannable
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION author_articles_max_id() RETURNS int AS $$
|
||||
DECLARE
|
||||
max_id integer;
|
||||
|
@ -1614,12 +1613,14 @@ BEGIN
|
|||
return max_id;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A command for a distributed function is run. To make sure subsequent commands see the function correctly we need to make sure to use only one connection for all future commands
|
||||
-- we don't want too many details. though we're omitting
|
||||
-- "DETAIL: distribution column value:", we see it acceptable
|
||||
-- since the query results verifies the correctness
|
||||
\set VERBOSITY terse
|
||||
SELECT author_articles_max_id();
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Distributed planning for a fast-path router query
|
||||
DEBUG: Creating router plan
|
||||
DEBUG: query has a single distribution column value: 1
|
||||
|
@ -1629,37 +1630,41 @@ DEBUG: query has a single distribution column value: 1
|
|||
(1 row)
|
||||
|
||||
SELECT author_articles_max_id();
|
||||
DEBUG: function does not have co-located tables
|
||||
author_articles_max_id
|
||||
---------------------------------------------------------------------
|
||||
41
|
||||
(1 row)
|
||||
|
||||
SELECT author_articles_max_id();
|
||||
DEBUG: function does not have co-located tables
|
||||
author_articles_max_id
|
||||
---------------------------------------------------------------------
|
||||
41
|
||||
(1 row)
|
||||
|
||||
SELECT author_articles_max_id();
|
||||
DEBUG: function does not have co-located tables
|
||||
author_articles_max_id
|
||||
---------------------------------------------------------------------
|
||||
41
|
||||
(1 row)
|
||||
|
||||
SELECT author_articles_max_id();
|
||||
DEBUG: function does not have co-located tables
|
||||
author_articles_max_id
|
||||
---------------------------------------------------------------------
|
||||
41
|
||||
(1 row)
|
||||
|
||||
SELECT author_articles_max_id();
|
||||
DEBUG: function does not have co-located tables
|
||||
author_articles_max_id
|
||||
---------------------------------------------------------------------
|
||||
41
|
||||
(1 row)
|
||||
|
||||
-- queries inside plpgsql functions could be router plannable
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION author_articles_max_id(int) RETURNS int AS $$
|
||||
DECLARE
|
||||
max_id integer;
|
||||
|
@ -1670,8 +1675,9 @@ BEGIN
|
|||
return max_id;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
SELECT author_articles_max_id(1);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
DEBUG: Creating router plan
|
||||
author_articles_max_id
|
||||
|
@ -1680,6 +1686,7 @@ DEBUG: Creating router plan
|
|||
(1 row)
|
||||
|
||||
SELECT author_articles_max_id(1);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
DEBUG: Creating router plan
|
||||
author_articles_max_id
|
||||
|
@ -1688,6 +1695,7 @@ DEBUG: Creating router plan
|
|||
(1 row)
|
||||
|
||||
SELECT author_articles_max_id(1);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
DEBUG: Creating router plan
|
||||
author_articles_max_id
|
||||
|
@ -1696,6 +1704,7 @@ DEBUG: Creating router plan
|
|||
(1 row)
|
||||
|
||||
SELECT author_articles_max_id(1);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
DEBUG: Creating router plan
|
||||
author_articles_max_id
|
||||
|
@ -1704,6 +1713,7 @@ DEBUG: Creating router plan
|
|||
(1 row)
|
||||
|
||||
SELECT author_articles_max_id(1);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
DEBUG: Creating router plan
|
||||
author_articles_max_id
|
||||
|
@ -1712,6 +1722,7 @@ DEBUG: Creating router plan
|
|||
(1 row)
|
||||
|
||||
SELECT author_articles_max_id(1);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
DEBUG: Creating router plan
|
||||
author_articles_max_id
|
||||
|
@ -1720,7 +1731,6 @@ DEBUG: Creating router plan
|
|||
(1 row)
|
||||
|
||||
-- check that function returning setof query are router plannable
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION author_articles_id_word_count() RETURNS TABLE(id bigint, word_count int) AS $$
|
||||
DECLARE
|
||||
BEGIN
|
||||
|
@ -1731,8 +1741,9 @@ BEGIN
|
|||
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
SELECT * FROM author_articles_id_word_count();
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Distributed planning for a fast-path router query
|
||||
DEBUG: Creating router plan
|
||||
DEBUG: query has a single distribution column value: 1
|
||||
|
@ -1746,6 +1757,7 @@ DEBUG: query has a single distribution column value: 1
|
|||
(5 rows)
|
||||
|
||||
SELECT * FROM author_articles_id_word_count();
|
||||
DEBUG: function does not have co-located tables
|
||||
id | word_count
|
||||
---------------------------------------------------------------------
|
||||
1 | 9572
|
||||
|
@ -1756,6 +1768,7 @@ SELECT * FROM author_articles_id_word_count();
|
|||
(5 rows)
|
||||
|
||||
SELECT * FROM author_articles_id_word_count();
|
||||
DEBUG: function does not have co-located tables
|
||||
id | word_count
|
||||
---------------------------------------------------------------------
|
||||
1 | 9572
|
||||
|
@ -1766,6 +1779,7 @@ SELECT * FROM author_articles_id_word_count();
|
|||
(5 rows)
|
||||
|
||||
SELECT * FROM author_articles_id_word_count();
|
||||
DEBUG: function does not have co-located tables
|
||||
id | word_count
|
||||
---------------------------------------------------------------------
|
||||
1 | 9572
|
||||
|
@ -1776,6 +1790,7 @@ SELECT * FROM author_articles_id_word_count();
|
|||
(5 rows)
|
||||
|
||||
SELECT * FROM author_articles_id_word_count();
|
||||
DEBUG: function does not have co-located tables
|
||||
id | word_count
|
||||
---------------------------------------------------------------------
|
||||
1 | 9572
|
||||
|
@ -1786,6 +1801,7 @@ SELECT * FROM author_articles_id_word_count();
|
|||
(5 rows)
|
||||
|
||||
SELECT * FROM author_articles_id_word_count();
|
||||
DEBUG: function does not have co-located tables
|
||||
id | word_count
|
||||
---------------------------------------------------------------------
|
||||
1 | 9572
|
||||
|
@ -1796,7 +1812,6 @@ SELECT * FROM author_articles_id_word_count();
|
|||
(5 rows)
|
||||
|
||||
-- check that function returning setof query are router plannable
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION author_articles_id_word_count(int) RETURNS TABLE(id bigint, word_count int) AS $$
|
||||
DECLARE
|
||||
BEGIN
|
||||
|
@ -1807,8 +1822,9 @@ BEGIN
|
|||
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
SELECT * FROM author_articles_id_word_count(1);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
DEBUG: Creating router plan
|
||||
id | word_count
|
||||
|
@ -1821,6 +1837,7 @@ DEBUG: Creating router plan
|
|||
(5 rows)
|
||||
|
||||
SELECT * FROM author_articles_id_word_count(1);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
DEBUG: Creating router plan
|
||||
id | word_count
|
||||
|
@ -1833,6 +1850,7 @@ DEBUG: Creating router plan
|
|||
(5 rows)
|
||||
|
||||
SELECT * FROM author_articles_id_word_count(1);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
DEBUG: Creating router plan
|
||||
id | word_count
|
||||
|
@ -1845,6 +1863,7 @@ DEBUG: Creating router plan
|
|||
(5 rows)
|
||||
|
||||
SELECT * FROM author_articles_id_word_count(1);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
DEBUG: Creating router plan
|
||||
id | word_count
|
||||
|
@ -1857,6 +1876,7 @@ DEBUG: Creating router plan
|
|||
(5 rows)
|
||||
|
||||
SELECT * FROM author_articles_id_word_count(1);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
DEBUG: Creating router plan
|
||||
id | word_count
|
||||
|
@ -1869,6 +1889,7 @@ DEBUG: Creating router plan
|
|||
(5 rows)
|
||||
|
||||
SELECT * FROM author_articles_id_word_count(1);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Deferred pruning for a fast-path router query
|
||||
DEBUG: Creating router plan
|
||||
id | word_count
|
||||
|
|
|
@ -12,7 +12,6 @@ SET log_error_verbosity TO TERSE;
|
|||
SET citus.enable_repartition_joins TO ON;
|
||||
-- Function that parses explain output as JSON
|
||||
-- copied from multi_explain.sql
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION explain_json(query text)
|
||||
RETURNS jsonb
|
||||
AS $BODY$
|
||||
|
@ -23,7 +22,7 @@ BEGIN
|
|||
RETURN result;
|
||||
END;
|
||||
$BODY$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
SHOW log_error_verbosity;
|
||||
log_error_verbosity
|
||||
---------------------------------------------------------------------
|
||||
|
@ -38,6 +37,7 @@ FROM
|
|||
(SELECT users_table.user_id FROM users_table, events_table WHERE users_table.user_id = events_table.user_id AND event_type IN (5,6,7,8)) as bar
|
||||
WHERE
|
||||
foo.user_id = bar.user_id;$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.user_id, random() AS random FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT intermediate_result.user_id, intermediate_result.random FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer, random double precision)) foo, (SELECT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))) bar WHERE (foo.user_id OPERATOR(pg_catalog.=) bar.user_id)
|
||||
valid
|
||||
|
@ -53,6 +53,7 @@ FROM
|
|||
(SELECT users_table.user_id FROM users_table, events_table WHERE users_table.user_id = events_table.value_2 AND event_type IN (5,6,7,8)) as bar
|
||||
WHERE
|
||||
foo.user_id = bar.user_id;$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.user_id, random() AS random FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT intermediate_result.user_id, intermediate_result.random FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer, random double precision)) foo, (SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)) bar WHERE (foo.user_id OPERATOR(pg_catalog.=) bar.user_id)
|
||||
|
@ -75,6 +76,7 @@ WHERE
|
|||
users_table, events_table
|
||||
WHERE
|
||||
users_table.user_id = events_table.value_2 AND event_type IN (5,6));$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6])))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM public.users_table WHERE (value_1 OPERATOR(pg_catalog.=) ANY (SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)))
|
||||
valid
|
||||
|
@ -91,6 +93,7 @@ SELECT count(*) FROM q1, (SELECT
|
|||
users_table, events_table
|
||||
WHERE
|
||||
users_table.user_id = events_table.value_2 AND event_type IN (1,2,3,4)) as bar WHERE bar.user_id = q1.user_id ;$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: CTE q1 is going to be inlined via distributed planning
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.user_id, random() AS random FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT users_table.user_id FROM public.users_table) q1, (SELECT intermediate_result.user_id, intermediate_result.random FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer, random double precision)) bar WHERE (bar.user_id OPERATOR(pg_catalog.=) q1.user_id)
|
||||
|
@ -103,6 +106,7 @@ DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS c
|
|||
SELECT true AS valid FROM explain_json($$
|
||||
(SELECT users_table.user_id FROM users_table, events_table WHERE users_table.user_id = events_table.value_2 AND event_type IN (1,2,3,4)) UNION
|
||||
(SELECT users_table.user_id FROM users_table, events_table WHERE users_table.user_id = events_table.user_id AND event_type IN (5,6,7,8));$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer) UNION SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)
|
||||
|
@ -139,6 +143,7 @@ FROM (
|
|||
) q
|
||||
ORDER BY 2 DESC, 1;
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))
|
||||
DEBUG: push down of limit count: 5
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT user_id FROM public.users_table WHERE ((value_2 OPERATOR(pg_catalog.>=) 5) AND (EXISTS (SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)))) LIMIT 5
|
||||
|
@ -160,6 +165,7 @@ FROM
|
|||
(SELECT users_table.user_id, value_1 FROM users_table, events_table WHERE users_table.user_id = events_table.user_id AND event_type IN (5,6,7,8)) as bar
|
||||
WHERE
|
||||
foo.user_id = bar.value_1;$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT users_table.user_id, random() AS random FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))) foo, (SELECT intermediate_result.user_id, intermediate_result.value_1 FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer, value_1 integer)) bar WHERE (foo.user_id OPERATOR(pg_catalog.=) bar.value_1)
|
||||
valid
|
||||
|
|
|
@ -22,7 +22,6 @@ SET citus.enable_repartition_joins TO ON;
|
|||
-- copied from multi_explain.sql and had to give
|
||||
-- a different name via postfix to prevent concurrent
|
||||
-- create/drop etc.
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION explain_json_2(query text)
|
||||
RETURNS jsonb
|
||||
AS $BODY$
|
||||
|
@ -33,7 +32,7 @@ BEGIN
|
|||
RETURN result;
|
||||
END;
|
||||
$BODY$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
DEBUG: switching to sequential query execution mode
|
||||
-- leaf queries contain colocated joins
|
||||
-- but not the subquery
|
||||
SELECT true AS valid FROM explain_json_2($$
|
||||
|
@ -45,6 +44,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
WHERE
|
||||
foo.value_2 = bar.value_2;
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.value_2 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT foo.value_2 FROM (SELECT users_table.value_2 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))) foo, (SELECT intermediate_result.value_2 FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value_2 integer)) bar WHERE (foo.value_2 OPERATOR(pg_catalog.=) bar.value_2)
|
||||
valid
|
||||
|
@ -65,6 +65,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
(SELECT event_type FROM events_table WHERE user_id < 100);
|
||||
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT event_type FROM public.events_table WHERE (user_id OPERATOR(pg_catalog.<) 100)
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM public.events_table WHERE (event_type OPERATOR(pg_catalog.=) ANY (SELECT intermediate_result.event_type FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(event_type integer)))
|
||||
valid
|
||||
|
@ -84,6 +85,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
NOT IN
|
||||
(SELECT user_id FROM events_table WHERE event_type = 2);
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT user_id FROM public.events_table WHERE (event_type OPERATOR(pg_catalog.=) 2)
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM public.events_table WHERE (NOT (user_id OPERATOR(pg_catalog.=) ANY (SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer))))
|
||||
valid
|
||||
|
@ -105,6 +107,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
foo.event_type IN (SELECT event_type FROM events_table WHERE user_id < 3);
|
||||
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT event_type FROM public.events_table WHERE (user_id OPERATOR(pg_catalog.<) 3)
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT foo.user_id FROM (SELECT users_table.user_id, events_table.event_type FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))) foo, (SELECT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))) bar WHERE ((foo.user_id OPERATOR(pg_catalog.=) bar.user_id) AND (foo.event_type OPERATOR(pg_catalog.=) ANY (SELECT intermediate_result.event_type FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(event_type integer))))
|
||||
valid
|
||||
|
@ -125,6 +128,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
foo.user_id = bar.user_id AND
|
||||
foo.user_id IN (SELECT user_id FROM events_table WHERE user_id < 10);
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT (users_table.user_id OPERATOR(pg_catalog./) 2) AS user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT foo.user_id FROM (SELECT users_table.user_id, events_table.event_type FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))) foo, (SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)) bar WHERE ((foo.user_id OPERATOR(pg_catalog.=) bar.user_id) AND (foo.user_id OPERATOR(pg_catalog.=) ANY (SELECT events_table.user_id FROM public.events_table WHERE (events_table.user_id OPERATOR(pg_catalog.<) 10))))
|
||||
valid
|
||||
|
@ -145,6 +149,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
foo.user_id = bar.user_id AND
|
||||
foo.user_id NOT IN (SELECT user_id FROM events_table WHERE user_id < 10);
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT (users_table.user_id OPERATOR(pg_catalog./) 2) AS user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT user_id FROM public.events_table WHERE (user_id OPERATOR(pg_catalog.<) 10)
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT foo.user_id FROM (SELECT users_table.user_id, events_table.event_type FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))) foo, (SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)) bar WHERE ((foo.user_id OPERATOR(pg_catalog.=) bar.user_id) AND (NOT (foo.user_id OPERATOR(pg_catalog.=) ANY (SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)))))
|
||||
|
@ -166,6 +171,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
foo.user_id = bar.user_id AND
|
||||
foo.event_type IN (SELECT event_type FROM events_table WHERE user_id < 4);
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.user_id, events_table.event_type FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT event_type FROM public.events_table WHERE (user_id OPERATOR(pg_catalog.<) 4)
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT foo.user_id FROM (SELECT intermediate_result.user_id, intermediate_result.event_type FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer, event_type integer)) foo, (SELECT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))) bar WHERE ((foo.user_id OPERATOR(pg_catalog.=) bar.user_id) AND (foo.event_type OPERATOR(pg_catalog.=) ANY (SELECT intermediate_result.event_type FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(event_type integer))))
|
||||
|
@ -190,6 +196,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
|
||||
) as foo_top, events_table WHERE events_table.user_id = foo_top.user_id;
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.user_id, events_table.event_type FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.event_type) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))
|
||||
DEBUG: generating subplan XXX_3 for subquery SELECT event_type FROM public.events_table WHERE (user_id OPERATOR(pg_catalog.=) 5)
|
||||
|
@ -224,6 +231,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
) as foo_top;
|
||||
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[17, 18, 19, 20])))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT user_id, random FROM (SELECT foo1.user_id, random() AS random FROM (SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))) foo1, (SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))) foo2, (SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[9, 10, 11, 12])))) foo3, (SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[13, 14, 15, 16])))) foo4, (SELECT intermediate_result.user_id, intermediate_result.value_1 FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer, value_1 integer)) foo5 WHERE ((foo1.user_id OPERATOR(pg_catalog.=) foo4.user_id) AND (foo1.user_id OPERATOR(pg_catalog.=) foo2.user_id) AND (foo1.user_id OPERATOR(pg_catalog.=) foo3.user_id) AND (foo1.user_id OPERATOR(pg_catalog.=) foo4.user_id) AND (foo1.user_id OPERATOR(pg_catalog.=) foo5.value_1))) foo_top
|
||||
valid
|
||||
|
@ -255,6 +263,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
foo1.user_id = foo5.user_id
|
||||
) as foo_top;
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[17, 18, 19, 20])))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT user_id, random FROM (SELECT foo1.user_id, random() AS random FROM (SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))) foo1, (SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))) foo2, (SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[9, 10, 11, 12])))) foo3, (SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[13, 14, 15, 16])))) foo4, (SELECT intermediate_result.user_id, intermediate_result.value_1 FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer, value_1 integer)) foo5 WHERE ((foo1.user_id OPERATOR(pg_catalog.=) foo4.user_id) AND (foo1.user_id OPERATOR(pg_catalog.=) foo2.user_id) AND (foo1.user_id OPERATOR(pg_catalog.=) foo3.user_id) AND (foo1.user_id OPERATOR(pg_catalog.=) foo4.user_id) AND (foo1.user_id OPERATOR(pg_catalog.=) foo5.user_id))) foo_top
|
||||
valid
|
||||
|
@ -284,6 +293,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
foo1.user_id = foo5.value_1
|
||||
) as foo_top;
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[17, 18, 19, 20])))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT user_id, random FROM (SELECT foo1.user_id, random() AS random FROM (SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))) foo1, (SELECT intermediate_result.user_id, intermediate_result.value_1 FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer, value_1 integer)) foo2, (SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[9, 10, 11, 12])))) foo3, (SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[13, 14, 15, 16])))) foo4, (SELECT intermediate_result.user_id, intermediate_result.value_1 FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer, value_1 integer)) foo5 WHERE ((foo1.user_id OPERATOR(pg_catalog.=) foo4.user_id) AND (foo1.user_id OPERATOR(pg_catalog.=) foo2.user_id) AND (foo1.user_id OPERATOR(pg_catalog.=) foo3.user_id) AND (foo1.user_id OPERATOR(pg_catalog.=) foo4.user_id) AND (foo1.user_id OPERATOR(pg_catalog.=) foo5.value_1))) foo_top
|
||||
|
@ -315,6 +325,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
foo2.user_id = foo5.value_1
|
||||
) as foo_top;
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[17, 18, 19, 20])))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT user_id, random FROM (SELECT foo1.user_id, random() AS random FROM (SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))) foo1, (SELECT intermediate_result.user_id, intermediate_result.value_1 FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer, value_1 integer)) foo2, (SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[9, 10, 11, 12])))) foo3, (SELECT users_table.user_id, users_table.value_1 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[13, 14, 15, 16])))) foo4, (SELECT intermediate_result.user_id, intermediate_result.value_1 FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer, value_1 integer)) foo5 WHERE ((foo1.user_id OPERATOR(pg_catalog.=) foo4.user_id) AND (foo1.user_id OPERATOR(pg_catalog.=) foo2.user_id) AND (foo1.user_id OPERATOR(pg_catalog.=) foo3.user_id) AND (foo1.user_id OPERATOR(pg_catalog.=) foo4.user_id) AND (foo2.user_id OPERATOR(pg_catalog.=) foo5.value_1))) foo_top
|
||||
|
@ -348,6 +359,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
foo.user_id = bar.user_id) as bar_top
|
||||
ON (foo_top.user_id = bar_top.user_id);
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM ((SELECT foo.user_id FROM (SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)) foo, (SELECT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))) bar WHERE (foo.user_id OPERATOR(pg_catalog.=) bar.user_id)) foo_top JOIN (SELECT foo.user_id FROM (SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)) foo, (SELECT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))) bar WHERE (foo.user_id OPERATOR(pg_catalog.=) bar.user_id)) bar_top ON ((foo_top.user_id OPERATOR(pg_catalog.=) bar_top.user_id)))
|
||||
|
@ -382,6 +394,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
ON (foo_top.value_2 = bar_top.user_id);
|
||||
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT foo.user_id FROM (SELECT DISTINCT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[9, 10, 11, 12])))) foo, (SELECT DISTINCT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[13, 14, 15, 16])))) bar WHERE (foo.user_id OPERATOR(pg_catalog.=) bar.user_id)
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM ((SELECT foo.user_id, foo.value_2 FROM (SELECT DISTINCT users_table.user_id, users_table.value_2 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))) foo, (SELECT DISTINCT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))) bar WHERE (foo.user_id OPERATOR(pg_catalog.=) bar.user_id)) foo_top JOIN (SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)) bar_top ON ((foo_top.value_2 OPERATOR(pg_catalog.=) bar_top.user_id)))
|
||||
valid
|
||||
|
@ -413,6 +426,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
foo.user_id = bar.user_id) as bar_top
|
||||
ON (foo_top.value_2 = bar_top.user_id);
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT DISTINCT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[13, 14, 15, 16])))
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT foo.user_id FROM (SELECT DISTINCT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[9, 10, 11, 12])))) foo, (SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)) bar WHERE (foo.user_id OPERATOR(pg_catalog.=) bar.user_id)
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM ((SELECT foo.user_id, foo.value_2 FROM (SELECT DISTINCT users_table.user_id, users_table.value_2 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))) foo, (SELECT DISTINCT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))) bar WHERE (foo.user_id OPERATOR(pg_catalog.=) bar.user_id)) foo_top JOIN (SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)) bar_top ON ((foo_top.value_2 OPERATOR(pg_catalog.=) bar_top.user_id)))
|
||||
|
@ -434,6 +448,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
WHERE foo.my_users = users_table.user_id) as mid_level_query
|
||||
) as bar;
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT events_table.user_id AS my_users FROM public.events_table, public.users_table WHERE (events_table.event_type OPERATOR(pg_catalog.=) users_table.user_id)
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT mid_level_query.user_id FROM (SELECT DISTINCT users_table.user_id FROM public.users_table, (SELECT intermediate_result.my_users FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(my_users integer)) foo WHERE (foo.my_users OPERATOR(pg_catalog.=) users_table.user_id)) mid_level_query) bar
|
||||
valid
|
||||
|
@ -453,6 +468,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
WHERE foo.my_users = users_table.user_id) as mid_level_query ) as bar;
|
||||
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT events_table.event_type AS my_users, random() AS random FROM public.events_table, public.users_table WHERE (events_table.user_id OPERATOR(pg_catalog.=) users_table.user_id)
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT mid_level_query.user_id FROM (SELECT DISTINCT users_table.user_id FROM public.users_table, (SELECT intermediate_result.my_users, intermediate_result.random FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(my_users integer, random double precision)) foo WHERE (foo.my_users OPERATOR(pg_catalog.=) users_table.user_id)) mid_level_query) bar
|
||||
valid
|
||||
|
@ -476,6 +492,7 @@ DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS c
|
|||
WHERE foo.my_users = users_table.user_id) as mid_level_query
|
||||
) as bar;
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT events_table.user_id, random() AS random FROM public.users_table, public.events_table WHERE (users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id)
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT mid_level_query.user_id FROM (SELECT DISTINCT users_table.user_id FROM public.users_table, (SELECT events_table.user_id AS my_users FROM public.events_table, (SELECT intermediate_result.user_id, intermediate_result.random FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer, random double precision)) selected_users WHERE (events_table.event_type OPERATOR(pg_catalog.=) selected_users.user_id)) foo WHERE (foo.my_users OPERATOR(pg_catalog.=) users_table.user_id)) mid_level_query) bar
|
||||
valid
|
||||
|
@ -509,6 +526,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
) as bar;
|
||||
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT value_2 FROM public.events_table
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT mid_level_query.user_id FROM (SELECT DISTINCT users_table.user_id FROM public.users_table, (SELECT events_table.user_id AS my_users FROM public.events_table, (SELECT events_table_1.user_id FROM public.users_table users_table_1, public.events_table events_table_1 WHERE ((users_table_1.user_id OPERATOR(pg_catalog.=) events_table_1.user_id) AND (users_table_1.user_id OPERATOR(pg_catalog.=) ANY (SELECT intermediate_result.value_2 FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value_2 integer))))) selected_users WHERE (events_table.user_id OPERATOR(pg_catalog.=) selected_users.user_id)) foo WHERE (foo.my_users OPERATOR(pg_catalog.=) users_table.user_id)) mid_level_query) bar
|
||||
valid
|
||||
|
@ -530,6 +548,7 @@ WHERE
|
|||
users_table, events_table
|
||||
WHERE
|
||||
users_table.user_id = events_table.value_2 AND event_type IN (5,6));$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6])))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM public.users_table WHERE (value_1 OPERATOR(pg_catalog.=) ANY (SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)))
|
||||
valid
|
||||
|
@ -546,6 +565,7 @@ SELECT count(*) FROM q1, (SELECT
|
|||
users_table, events_table
|
||||
WHERE
|
||||
users_table.user_id = events_table.value_2 AND event_type IN (1,2,3,4)) as bar WHERE bar.user_id = q1.user_id ;$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: CTE q1 is going to be inlined via distributed planning
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.user_id, random() AS random FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT users_table.user_id FROM public.users_table) q1, (SELECT intermediate_result.user_id, intermediate_result.random FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer, random double precision)) bar WHERE (bar.user_id OPERATOR(pg_catalog.=) q1.user_id)
|
||||
|
@ -563,6 +583,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
users_table, events_table
|
||||
WHERE
|
||||
users_table.user_id = events_table.user_id AND event_type IN (1,2,3,4)) as bar WHERE bar.user_id = q1.user_id ;$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for CTE q1: SELECT user_id FROM public.users_table
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)) q1, (SELECT users_table.user_id, random() AS random FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))) bar WHERE (bar.user_id OPERATOR(pg_catalog.=) q1.user_id)
|
||||
valid
|
||||
|
@ -574,6 +595,7 @@ DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS c
|
|||
SELECT true AS valid FROM explain_json_2($$
|
||||
(SELECT users_table.user_id FROM users_table, events_table WHERE users_table.user_id = events_table.value_2 AND event_type IN (1,2,3,4)) UNION
|
||||
(SELECT users_table.user_id FROM users_table, events_table WHERE users_table.user_id = events_table.user_id AND event_type IN (5,6,7,8));$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer) UNION SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)
|
||||
|
@ -610,6 +632,7 @@ FROM (
|
|||
) q
|
||||
ORDER BY 2 DESC, 1;
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.user_id FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.value_2) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))
|
||||
DEBUG: push down of limit count: 5
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT user_id FROM public.users_table WHERE ((value_2 OPERATOR(pg_catalog.>=) 5) AND (EXISTS (SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)))) LIMIT 5
|
||||
|
@ -631,6 +654,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
FROM
|
||||
(users_table u1 JOIN users_table u2 using(value_1)) a JOIN (SELECT value_1, random() FROM users_table) as u3 USING (value_1);
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT value_1, random() AS random FROM public.users_table
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM ((public.users_table u1 JOIN public.users_table u2 USING (value_1)) a(value_1, user_id, "time", value_2, value_3, value_4, user_id_1, time_1, value_2_1, value_3_1, value_4_1) JOIN (SELECT intermediate_result.value_1, intermediate_result.random FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value_1 integer, random double precision)) u3 USING (value_1))
|
||||
ERROR: complex joins are only supported when all distributed tables are co-located and joined on their distribution columns
|
||||
|
@ -643,6 +667,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
FROM
|
||||
(SELECT * FROM users_table u1 JOIN users_table u2 using(value_1)) a JOIN (SELECT value_1, random() FROM users_table) as u3 USING (value_1);
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT u1.value_1, u1.user_id, u1."time", u1.value_2, u1.value_3, u1.value_4, u2.user_id, u2."time", u2.value_2, u2.value_3, u2.value_4 FROM (public.users_table u1 JOIN public.users_table u2 USING (value_1))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM ((SELECT intermediate_result.value_1, intermediate_result.user_id, intermediate_result."time", intermediate_result.value_2, intermediate_result.value_3, intermediate_result.value_4, intermediate_result.user_id_1 AS user_id, intermediate_result.time_1 AS "time", intermediate_result.value_2_1 AS value_2, intermediate_result.value_3_1 AS value_3, intermediate_result.value_4_1 AS value_4 FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value_1 integer, user_id integer, "time" timestamp without time zone, value_2 integer, value_3 double precision, value_4 bigint, user_id_1 integer, time_1 timestamp without time zone, value_2_1 integer, value_3_1 double precision, value_4_1 bigint)) a(value_1, user_id, "time", value_2, value_3, value_4, user_id_1, time_1, value_2_1, value_3_1, value_4_1) JOIN (SELECT users_table.value_1, random() AS random FROM public.users_table) u3 USING (value_1))
|
||||
valid
|
||||
|
@ -662,6 +687,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
events_table
|
||||
using (value_2);
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT value_2, random() AS random FROM public.users_table
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM ((SELECT intermediate_result.value_2, intermediate_result.random FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value_2 integer, random double precision)) u1 JOIN public.events_table USING (value_2))
|
||||
valid
|
||||
|
@ -680,6 +706,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
(SELECT value_2, random() FROM users_table) as u2
|
||||
USING(value_2);
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT value_2, random() AS random FROM public.users_table
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM ((SELECT users_table.value_2, random() AS random FROM public.users_table) u1 LEFT JOIN (SELECT intermediate_result.value_2, intermediate_result.random FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value_2 integer, random double precision)) u2 USING (value_2))
|
||||
valid
|
||||
|
@ -700,6 +727,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
(SELECT value_2, random() FROM users_table) as u2
|
||||
USING(value_2);
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT value_2, random() AS random FROM public.users_table
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM ((SELECT users_table.value_2, random() AS random FROM public.users_table) u1 RIGHT JOIN (SELECT intermediate_result.value_2, intermediate_result.random FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value_2 integer, random double precision)) u2 USING (value_2))
|
||||
ERROR: cannot pushdown the subquery
|
||||
|
@ -719,6 +747,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
(SELECT value_1 FROM users_table) as foo ON (a.user_id = foo.value_1)
|
||||
);
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT user_id FROM public.users_table
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT user_id FROM public.users_table
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer) UNION SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)
|
||||
|
@ -743,6 +772,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
users_table as foo ON (a.user_id = foo.value_1)
|
||||
);
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT user_id FROM public.users_table
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT user_id FROM public.users_table
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer) UNION SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)
|
||||
|
@ -776,6 +806,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
ON(foo.user_id = bar.value_1)
|
||||
);
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT value_1 FROM public.users_table
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT foo.user_id, a.user_id, bar.value_1 FROM (((SELECT users_table.user_id FROM public.users_table) foo JOIN (SELECT users_table.user_id FROM public.users_table WHERE (users_table.user_id OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])) UNION SELECT users_table.user_id FROM public.users_table WHERE (users_table.user_id OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8]))) a ON ((a.user_id OPERATOR(pg_catalog.=) foo.user_id))) JOIN (SELECT intermediate_result.value_1 FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value_1 integer)) bar ON ((foo.user_id OPERATOR(pg_catalog.=) bar.value_1)))
|
||||
valid
|
||||
|
@ -815,6 +846,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
WHERE
|
||||
non_colocated_subquery.value_2 != non_colocated_subquery_2.cnt
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: CTE non_colocated_subquery is going to be inlined via distributed planning
|
||||
DEBUG: CTE non_colocated_subquery_2 is going to be inlined via distributed planning
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table.value_2 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))
|
||||
|
@ -839,6 +871,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
AND
|
||||
foo.value_2 = baz.value_2
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT users_table_local.value_2 FROM non_colocated_subquery.users_table_local, non_colocated_subquery.events_table_local WHERE ((users_table_local.user_id OPERATOR(pg_catalog.=) events_table_local.user_id) AND (events_table_local.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[5, 6, 7, 8])))
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT users_table.value_2 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[9, 10, 11, 12])))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT users_table.value_2 FROM public.users_table, public.events_table WHERE ((users_table.user_id OPERATOR(pg_catalog.=) events_table.user_id) AND (events_table.event_type OPERATOR(pg_catalog.=) ANY (ARRAY[1, 2, 3, 4])))) foo, (SELECT intermediate_result.value_2 FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value_2 integer)) bar, (SELECT intermediate_result.value_2 FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(value_2 integer)) baz WHERE ((foo.value_2 OPERATOR(pg_catalog.=) bar.value_2) AND (foo.value_2 OPERATOR(pg_catalog.=) baz.value_2))
|
||||
|
@ -874,6 +907,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
AND
|
||||
foo.user_id IN (SELECT users_table.user_id FROM users_table, events_table WHERE users_table.user_id = events_table.user_id AND event_type IN (1,2))
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT value_1, value_2 FROM public.users_table
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT value_1 FROM public.users_table WHERE (value_2 OPERATOR(pg_catalog.<) 1)
|
||||
DEBUG: generating subplan XXX_3 for subquery SELECT value_2 FROM public.users_table WHERE (value_1 OPERATOR(pg_catalog.<) 2)
|
||||
|
@ -896,6 +930,7 @@ SELECT true AS valid FROM explain_json_2($$
|
|||
users_table_ref.user_id = foo.user_id
|
||||
AND foo.user_id = bar.value_2;
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT user_id, value_2 FROM public.events_table
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM public.users_reference_table users_table_ref, (SELECT users_table.user_id FROM public.users_table) foo, (SELECT intermediate_result.user_id, intermediate_result.value_2 FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer, value_2 integer)) bar WHERE ((users_table_ref.user_id OPERATOR(pg_catalog.=) foo.user_id) AND (foo.user_id OPERATOR(pg_catalog.=) bar.value_2))
|
||||
valid
|
||||
|
@ -944,6 +979,7 @@ JOIN LATERAL
|
|||
WHERE user_id = users_table.user_id) AS bar
|
||||
LEFT JOIN users_table u2 ON u2.user_id = bar.value_2) AS foo ON TRUE
|
||||
$$);
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Router planner cannot handle multi-shard select queries
|
||||
DEBUG: skipping recursive planning for the subquery since it contains references to outer queries
|
||||
DEBUG: skipping recursive planning for the subquery since it contains references to outer queries
|
||||
|
|
|
@ -142,14 +142,12 @@ SELECT * FROM text_table ORDER BY 1;
|
|||
|
||||
-- Test that we don't propagate base types
|
||||
CREATE TYPE myvarchar;
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE FUNCTION myvarcharin(cstring, oid, integer) RETURNS myvarchar
|
||||
LANGUAGE internal IMMUTABLE PARALLEL SAFE STRICT AS 'varcharin';
|
||||
NOTICE: return type myvarchar is only a shell
|
||||
CREATE FUNCTION myvarcharout(myvarchar) RETURNS cstring
|
||||
LANGUAGE internal IMMUTABLE PARALLEL SAFE STRICT AS 'varcharout';
|
||||
NOTICE: argument type myvarchar is only a shell
|
||||
RESET citus.enable_metadata_sync;
|
||||
CREATE TYPE myvarchar (
|
||||
input = myvarcharin,
|
||||
output = myvarcharout,
|
||||
|
@ -162,7 +160,7 @@ CREATE TABLE my_table (a int, b myvarchar);
|
|||
-- """Add ALTER TYPE options useful for extensions,
|
||||
-- like TOAST and I/O functions control (Tomas Vondra, Tom Lane)"""
|
||||
SELECT create_distributed_table('my_table', 'a');
|
||||
ERROR: type "test_pg13.myvarchar" does not exist
|
||||
ERROR: type "test_pg13.myvarchar" is only a shell
|
||||
CONTEXT: while executing command on localhost:xxxxx
|
||||
CREATE TABLE test_table(a int, b tsvector);
|
||||
SELECT create_distributed_table('test_table', 'a');
|
||||
|
|
|
@ -12,11 +12,9 @@ SELECT create_distributed_table('dist_table', 'id', colocate_with => 'users_tabl
|
|||
(1 row)
|
||||
|
||||
INSERT INTO dist_table (id, value) VALUES(1, 2),(2, 3),(3,4);
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE FUNCTION func() RETURNS TABLE (id int, value int) AS $$
|
||||
SELECT 1, 2
|
||||
$$ LANGUAGE SQL;
|
||||
RESET citus.enable_metadata_sync;
|
||||
SET client_min_messages TO DEBUG1;
|
||||
-- CTEs are recursively planned, and subquery foo is also recursively planned
|
||||
-- final plan becomes a router plan
|
||||
|
@ -128,6 +126,7 @@ WITH cte1 AS MATERIALIZED (SELECT id, value FROM func())
|
|||
UPDATE dist_table dt SET value = cte1.value
|
||||
FROM cte1 WHERE dt.id = 1;
|
||||
DEBUG: generating subplan XXX_1 for CTE cte1: SELECT id, value FROM subquery_and_ctes.func() func(id, value)
|
||||
DEBUG: function does not have co-located tables
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: UPDATE subquery_and_ctes.dist_table dt SET value = cte1.value FROM (SELECT intermediate_result.id, intermediate_result.value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(id integer, value integer)) cte1 WHERE (dt.id OPERATOR(pg_catalog.=) 1)
|
||||
-- CTEs are recursively planned, and subquery foo is also recursively planned
|
||||
-- final plan becomes a real-time plan since we also have events_table in the
|
||||
|
|
|
@ -462,7 +462,6 @@ SELECT * FROM test ORDER BY id;
|
|||
DROP TABLE test;
|
||||
|
||||
-- verify that recreating distributed functions with TABLE params gets propagated to workers
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION func_with_return_table(int)
|
||||
RETURNS TABLE (date date)
|
||||
LANGUAGE plpgsql AS $$
|
||||
|
@ -470,11 +469,9 @@ BEGIN
|
|||
RETURN query SELECT '2011-01-01'::date;
|
||||
END;
|
||||
$$;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
SELECT create_distributed_function('func_with_return_table(int)');
|
||||
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION func_with_return_table(int)
|
||||
RETURNS TABLE (date date)
|
||||
LANGUAGE plpgsql AS $$
|
||||
|
@ -482,7 +479,6 @@ BEGIN
|
|||
RETURN query SELECT '2011-01-02'::date;
|
||||
END;
|
||||
$$;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
SELECT count(*) FROM
|
||||
(SELECT result FROM
|
||||
|
|
|
@ -101,13 +101,11 @@ EXECUTE p1(5,5,5);
|
|||
EXECUTE p1(6,6,6);
|
||||
EXECUTE p1(7,7,7);
|
||||
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE FUNCTION modify_fast_path_plpsql(int, int) RETURNS void as $$
|
||||
BEGIN
|
||||
DELETE FROM modify_fast_path WHERE key = $1 AND value_1 = $2;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
SELECT modify_fast_path_plpsql(1,1);
|
||||
SELECT modify_fast_path_plpsql(2,2);
|
||||
|
|
|
@ -159,7 +159,6 @@ INSERT INTO test_nested VALUES (300,'threehundred');
|
|||
INSERT INTO test_nested VALUES (400,'fourhundred');
|
||||
INSERT INTO test_nested VALUES (512,'fivetwelve');
|
||||
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION inner_force_delegation_function(int)
|
||||
RETURNS NUMERIC AS $$
|
||||
DECLARE ret_val NUMERIC;
|
||||
|
@ -169,7 +168,6 @@ BEGIN
|
|||
RETURN ret_val;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
CREATE OR REPLACE FUNCTION func_calls_forcepush_func()
|
||||
RETURNS NUMERIC AS $$
|
||||
|
@ -191,7 +189,6 @@ COMMIT;
|
|||
|
||||
SELECT func_calls_forcepush_func();
|
||||
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION get_val()
|
||||
RETURNS INT AS $$
|
||||
BEGIN
|
||||
|
@ -216,7 +213,6 @@ BEGIN
|
|||
RETURN incremented_val;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
SELECT func_calls_forcepush_func_infrom();
|
||||
|
||||
|
@ -231,7 +227,6 @@ COMMIT;
|
|||
-- select fn() into var;
|
||||
-- }
|
||||
--
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION func_calls_forcepush_func_intarget()
|
||||
RETURNS NUMERIC AS $$
|
||||
DECLARE incremented_val NUMERIC;
|
||||
|
@ -242,7 +237,6 @@ BEGIN
|
|||
RETURN incremented_val;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
SELECT func_calls_forcepush_func_intarget();
|
||||
|
||||
|
@ -342,7 +336,6 @@ BEGIN
|
|||
INSERT INTO emp VALUES (empname, 33);
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION outer_emp()
|
||||
RETURNS void
|
||||
AS $$
|
||||
|
@ -351,7 +344,6 @@ BEGIN
|
|||
PERFORM inner_emp('hello');
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
SELECT create_distributed_function('inner_emp(text)','empname', force_delegation := true);
|
||||
SELECT outer_emp();
|
||||
|
@ -640,7 +632,6 @@ $$ LANGUAGE plpgsql;
|
|||
SELECT create_distributed_function('test_prepare(int,int)','x',force_delegation :=true, colocate_with := 'table_test_prepare');
|
||||
|
||||
DROP FUNCTION outer_test_prepare(int, int);
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION outer_test_prepare(x int, y int)
|
||||
RETURNS void
|
||||
AS $$
|
||||
|
@ -651,7 +642,6 @@ BEGIN
|
|||
PERFORM 1, 1 + a FROM test_prepare(x + 1, y + 1) a;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
-- First 5 get delegated and succeeds
|
||||
BEGIN;
|
||||
|
|
|
@ -166,7 +166,6 @@ SET client_min_messages TO DEBUG1;
|
|||
select colocate_proc_with_table('mx_call_func', 'mx_call_dist_table_1'::regclass, 1);
|
||||
|
||||
-- Test table returning functions.
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE FUNCTION mx_call_func_tbl(x int)
|
||||
RETURNS TABLE (p0 int, p1 int)
|
||||
LANGUAGE plpgsql AS $$
|
||||
|
@ -180,7 +179,6 @@ BEGIN
|
|||
WHERE id >= x
|
||||
ORDER BY 1, 2;
|
||||
END;$$;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
-- before distribution ...
|
||||
select mx_call_func_tbl(10);
|
||||
|
|
|
@ -373,7 +373,6 @@ CREATE OR REPLACE FUNCTION trigger_metadata_sync()
|
|||
LANGUAGE C STRICT
|
||||
AS 'citus';
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
SELECT trigger_metadata_sync();
|
||||
|
||||
\c :datname - - :master_port
|
||||
|
|
|
@ -723,7 +723,6 @@ INTERSECT
|
|||
-- if these queries get routed, they would fail since number1() does not exist
|
||||
-- on workers. This tests an exceptional case in which some local tables bypass
|
||||
-- checks.
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION number1(OUT datid int)
|
||||
RETURNS SETOF int
|
||||
AS $$
|
||||
|
@ -732,7 +731,6 @@ BEGIN
|
|||
RETURN QUERY SELECT 1;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
SELECT 1 FROM authors_reference r JOIN (
|
||||
SELECT s.datid FROM number1() s LEFT JOIN pg_database d ON s.datid = d.oid
|
||||
|
@ -1131,7 +1129,6 @@ PREPARE author_articles(int) as
|
|||
EXECUTE author_articles(1);
|
||||
|
||||
-- queries inside plpgsql functions could be router plannable
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION author_articles_max_id() RETURNS int AS $$
|
||||
DECLARE
|
||||
max_id integer;
|
||||
|
@ -1156,7 +1153,6 @@ BEGIN
|
|||
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
SELECT * FROM author_articles_id_word_count() ORDER BY 1;
|
||||
|
||||
|
|
|
@ -687,7 +687,6 @@ EXECUTE author_articles_update(NULL);
|
|||
EXECUTE author_articles_update(NULL);
|
||||
|
||||
-- queries inside plpgsql functions could be router plannable
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION author_articles_max_id() RETURNS int AS $$
|
||||
DECLARE
|
||||
max_id integer;
|
||||
|
@ -698,7 +697,6 @@ BEGIN
|
|||
return max_id;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
-- we don't want too many details. though we're omitting
|
||||
-- "DETAIL: distribution column value:", we see it acceptable
|
||||
|
@ -713,7 +711,6 @@ SELECT author_articles_max_id();
|
|||
SELECT author_articles_max_id();
|
||||
|
||||
-- queries inside plpgsql functions could be router plannable
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION author_articles_max_id(int) RETURNS int AS $$
|
||||
DECLARE
|
||||
max_id integer;
|
||||
|
@ -724,7 +721,6 @@ BEGIN
|
|||
return max_id;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
SELECT author_articles_max_id(1);
|
||||
SELECT author_articles_max_id(1);
|
||||
SELECT author_articles_max_id(1);
|
||||
|
@ -733,7 +729,6 @@ SELECT author_articles_max_id(1);
|
|||
SELECT author_articles_max_id(1);
|
||||
|
||||
-- check that function returning setof query are router plannable
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION author_articles_id_word_count() RETURNS TABLE(id bigint, word_count int) AS $$
|
||||
DECLARE
|
||||
BEGIN
|
||||
|
@ -744,7 +739,6 @@ BEGIN
|
|||
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
SELECT * FROM author_articles_id_word_count();
|
||||
SELECT * FROM author_articles_id_word_count();
|
||||
|
@ -754,7 +748,6 @@ SELECT * FROM author_articles_id_word_count();
|
|||
SELECT * FROM author_articles_id_word_count();
|
||||
|
||||
-- check that function returning setof query are router plannable
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION author_articles_id_word_count(int) RETURNS TABLE(id bigint, word_count int) AS $$
|
||||
DECLARE
|
||||
BEGIN
|
||||
|
@ -765,7 +758,6 @@ BEGIN
|
|||
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
SELECT * FROM author_articles_id_word_count(1);
|
||||
SELECT * FROM author_articles_id_word_count(1);
|
||||
SELECT * FROM author_articles_id_word_count(1);
|
||||
|
|
|
@ -15,7 +15,6 @@ SET citus.enable_repartition_joins TO ON;
|
|||
|
||||
-- Function that parses explain output as JSON
|
||||
-- copied from multi_explain.sql
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION explain_json(query text)
|
||||
RETURNS jsonb
|
||||
AS $BODY$
|
||||
|
@ -26,7 +25,6 @@ BEGIN
|
|||
RETURN result;
|
||||
END;
|
||||
$BODY$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
SHOW log_error_verbosity;
|
||||
-- should recursively plan foo
|
||||
|
|
|
@ -25,7 +25,6 @@ SET citus.enable_repartition_joins TO ON;
|
|||
-- copied from multi_explain.sql and had to give
|
||||
-- a different name via postfix to prevent concurrent
|
||||
-- create/drop etc.
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION explain_json_2(query text)
|
||||
RETURNS jsonb
|
||||
AS $BODY$
|
||||
|
@ -36,7 +35,6 @@ BEGIN
|
|||
RETURN result;
|
||||
END;
|
||||
$BODY$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
|
||||
-- leaf queries contain colocated joins
|
||||
|
|
|
@ -74,12 +74,10 @@ SELECT * FROM text_table ORDER BY 1;
|
|||
|
||||
-- Test that we don't propagate base types
|
||||
CREATE TYPE myvarchar;
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE FUNCTION myvarcharin(cstring, oid, integer) RETURNS myvarchar
|
||||
LANGUAGE internal IMMUTABLE PARALLEL SAFE STRICT AS 'varcharin';
|
||||
CREATE FUNCTION myvarcharout(myvarchar) RETURNS cstring
|
||||
LANGUAGE internal IMMUTABLE PARALLEL SAFE STRICT AS 'varcharout';
|
||||
RESET citus.enable_metadata_sync;
|
||||
CREATE TYPE myvarchar (
|
||||
input = myvarcharin,
|
||||
output = myvarcharout,
|
||||
|
|
|
@ -11,11 +11,9 @@ CREATE TABLE dist_table (id int, value int);
|
|||
SELECT create_distributed_table('dist_table', 'id', colocate_with => 'users_table');
|
||||
INSERT INTO dist_table (id, value) VALUES(1, 2),(2, 3),(3,4);
|
||||
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE FUNCTION func() RETURNS TABLE (id int, value int) AS $$
|
||||
SELECT 1, 2
|
||||
$$ LANGUAGE SQL;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
SET client_min_messages TO DEBUG1;
|
||||
|
||||
|
|
Loading…
Reference in New Issue