diff --git a/contrib/postgres_fdw/Makefile b/contrib/postgres_fdw/Makefile index 1a24edbc6dc..1aa4beac74d 100644 --- a/contrib/postgres_fdw/Makefile +++ b/contrib/postgres_fdw/Makefile @@ -1,12 +1,9 @@ # contrib/postgres_fdw/Makefile MODULE_big = postgres_fdw -OBJS_FRONTEND = \ - link-canary.o OBJS = \ $(WIN32RES) \ - $(OBJS_FRONTEND) \ connection.o \ deparse.o \ option.o \ @@ -16,7 +13,7 @@ OBJS = \ PGFILEDESC = "postgres_fdw - foreign data wrapper for PostgreSQL" PG_CPPFLAGS = -I$(libpq_srcdir) -SHLIB_LINK_INTERNAL = -Wl,-Bsymbolic -Wl,-Bstatic -Wl,-Bstatic $(libpq) -Wl,-Bdynamic +SHLIB_LINK_INTERNAL = $(libpq) EXTENSION = postgres_fdw DATA = postgres_fdw--1.0.sql postgres_fdw--1.0--1.1.sql @@ -36,17 +33,6 @@ include $(top_builddir)/src/Makefile.global include $(top_srcdir)/contrib/contrib-global.mk endif -link-canary.c : % : $(top_srcdir)/src/common/% - rm -f $@ && $(LN_S) $< . - -link-canary.o: link-canary.c - $(CC) $(CFLAGS) -DFRONTEND $(CPPFLAGS) -c $< -o $@ - -clean: clean-symlinks - -clean-symlinks: - rm -f link-canary.c - # For postgres_fdw test export PG_PORT=5432 installcheck: install prep_postgres diff --git a/contrib/postgres_fdw/expected/gp2pg_postgres_fdw.out b/contrib/postgres_fdw/expected/gp2pg_postgres_fdw.out index b4154f8856c..a681547c9c8 100644 --- a/contrib/postgres_fdw/expected/gp2pg_postgres_fdw.out +++ b/contrib/postgres_fdw/expected/gp2pg_postgres_fdw.out @@ -93,13 +93,13 @@ CREATE TABLE "S 1"."T 4" ( ); -- Disable autovacuum for these tables to avoid unexpected effects of that ALTER TABLE "S 1"."T 1" SET (autovacuum_enabled = 'false'); -WARNING: autovacuum is not supported in Greenplum +WARNING: autovacuum is not supported in Cloudberry ALTER TABLE "S 1"."T 2" SET (autovacuum_enabled = 'false'); -WARNING: autovacuum is not supported in Greenplum +WARNING: autovacuum is not supported in Cloudberry ALTER TABLE "S 1"."T 3" SET (autovacuum_enabled = 'false'); -WARNING: autovacuum is not supported in Greenplum +WARNING: autovacuum is not supported in Cloudberry ALTER TABLE "S 1"."T 4" SET (autovacuum_enabled = 'false'); -WARNING: autovacuum is not supported in Greenplum +WARNING: autovacuum is not supported in Cloudberry INSERT INTO "S 1"."T 1" SELECT id, id % 10, @@ -7735,7 +7735,7 @@ CREATE TABLE a (aa TEXT); NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'aa' as the Greenplum Database data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. ALTER TABLE a SET (autovacuum_enabled = 'false'); -WARNING: autovacuum is not supported in Greenplum +WARNING: autovacuum is not supported in Cloudberry \! env PGOPTIONS='' psql -p ${PG_PORT} contrib_regression -c 'CREATE TABLE loct (aa TEXT, bb TEXT);' CREATE TABLE \! env PGOPTIONS='' psql -p ${PG_PORT} contrib_regression -c 'ALTER TABLE loct SET (autovacuum_enabled = 'false');' @@ -7849,9 +7849,9 @@ ALTER TABLE \! env PGOPTIONS='' psql -p ${PG_PORT} contrib_regression -c 'alter table loct2 set (autovacuum_enabled = 'false');' ALTER TABLE alter table loct1 set (autovacuum_enabled = 'false'); -WARNING: autovacuum is not supported in Greenplum +WARNING: autovacuum is not supported in Cloudberry alter table loct2 set (autovacuum_enabled = 'false'); -WARNING: autovacuum is not supported in Greenplum +WARNING: autovacuum is not supported in Cloudberry create table foo (f1 int, f2 int); NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'f1' as the Greenplum Database data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. @@ -7863,9 +7863,9 @@ HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sur create foreign table bar2 (f3 int) inherits (bar) server pgserver options (table_name 'loct2'); alter table foo set (autovacuum_enabled = 'false'); -WARNING: autovacuum is not supported in Greenplum +WARNING: autovacuum is not supported in Cloudberry alter table bar set (autovacuum_enabled = 'false'); -WARNING: autovacuum is not supported in Greenplum +WARNING: autovacuum is not supported in Cloudberry insert into foo values(1,1); insert into foo values(3,3); insert into foo2 values(2,2,2); diff --git a/contrib/postgres_fdw/expected/gp2pg_postgres_fdw_optimizer.out b/contrib/postgres_fdw/expected/gp2pg_postgres_fdw_optimizer.out index fa99ec154ff..505c1686f34 100644 --- a/contrib/postgres_fdw/expected/gp2pg_postgres_fdw_optimizer.out +++ b/contrib/postgres_fdw/expected/gp2pg_postgres_fdw_optimizer.out @@ -7,6 +7,9 @@ -- 2.2 gpdb don't support triggers for statements. -- 2.3 gpdb don't support REINDEX CONCURRENTLY. -- 3. gpdb will generate different PLAN from postgres, such as join local table and remote table, select for update/share and so on. +-- start_matchignore +-- m/^DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: .*$ +-- end_matchignore -- =================================================================== -- create FDW objects -- =================================================================== @@ -93,13 +96,13 @@ CREATE TABLE "S 1"."T 4" ( ); -- Disable autovacuum for these tables to avoid unexpected effects of that ALTER TABLE "S 1"."T 1" SET (autovacuum_enabled = 'false'); -WARNING: autovacuum is not supported in Greenplum +WARNING: autovacuum is not supported in Cloudberry ALTER TABLE "S 1"."T 2" SET (autovacuum_enabled = 'false'); -WARNING: autovacuum is not supported in Greenplum +WARNING: autovacuum is not supported in Cloudberry ALTER TABLE "S 1"."T 3" SET (autovacuum_enabled = 'false'); -WARNING: autovacuum is not supported in Greenplum +WARNING: autovacuum is not supported in Cloudberry ALTER TABLE "S 1"."T 4" SET (autovacuum_enabled = 'false'); -WARNING: autovacuum is not supported in Greenplum +WARNING: autovacuum is not supported in Cloudberry INSERT INTO "S 1"."T 1" SELECT id, id % 10, @@ -214,12 +217,12 @@ ERROR: parameter "extensions" must be a list of extension names ALTER SERVER testserver1 OPTIONS (ADD extensions 'foo, bar'); WARNING: extension "foo" is not installed WARNING: extension "bar" is not installed -WARNING: extension "foo" is not installed (seg0 127.0.0.1:7007 pid=3385) -WARNING: extension "bar" is not installed (seg0 127.0.0.1:7007 pid=3385) -WARNING: extension "foo" is not installed (seg1 127.0.0.1:7008 pid=3386) -WARNING: extension "bar" is not installed (seg1 127.0.0.1:7008 pid=3386) -WARNING: extension "foo" is not installed (seg2 127.0.0.1:7009 pid=3387) -WARNING: extension "bar" is not installed (seg2 127.0.0.1:7009 pid=3387) +WARNING: extension "foo" is not installed (seg0 127.0.0.1:7002 pid=19170) +WARNING: extension "foo" is not installed (seg1 127.0.0.1:7003 pid=19171) +WARNING: extension "foo" is not installed (seg2 127.0.0.1:7004 pid=19172) +WARNING: extension "bar" is not installed (seg0 127.0.0.1:7002 pid=19170) +WARNING: extension "bar" is not installed (seg1 127.0.0.1:7003 pid=19171) +WARNING: extension "bar" is not installed (seg2 127.0.0.1:7004 pid=19172) ALTER SERVER testserver1 OPTIONS (DROP extensions); ALTER USER MAPPING FOR public SERVER testserver1 OPTIONS (DROP user, DROP password); @@ -289,13 +292,13 @@ ALTER FOREIGN TABLE ft2 OPTIONS (use_remote_estimate 'true'); -- =================================================================== -- single table without alias EXPLAIN (COSTS OFF) SELECT * FROM ft1 ORDER BY c3, c1 OFFSET 100 LIMIT 10; - QUERY PLAN ---------------------------------------- + QUERY PLAN +--------------------------------- Limit -> Sort Sort Key: c3, c1 -> Foreign Scan on ft1 - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (5 rows) SELECT * FROM ft1 ORDER BY c3, c1 OFFSET 100 LIMIT 10; @@ -327,7 +330,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 ORDER BY t1.c3, t1.c1, t1.tabl -> Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8, tableoid Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (11 rows) SELECT * FROM ft1 t1 ORDER BY t1.c3, t1.c1, t1.tableoid OFFSET 100 LIMIT 10; @@ -387,7 +390,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 101 AND t1.c6 = Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE ((("C 1" = 101) AND (c6 = '1'::text) AND (c7 >= '1'::bpchar))) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) SELECT * FROM ft1 t1 WHERE t1.c1 = 101 AND t1.c6 = '1' AND t1.c7 >= '1'; @@ -496,8 +499,8 @@ SET enable_mergejoin TO true; -- inner join; expressions in the clauses appear in the equivalence class list EXPLAIN (VERBOSE, COSTS OFF) SELECT t1.c1, t2."C 1" FROM ft2 t1 JOIN "S 1"."T 1" t2 ON (t1.c1 = t2."C 1") order by t1.c1 OFFSET 100 LIMIT 10; - QUERY PLAN ---------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------- Limit Output: c1, t2."C 1" -> Gather Motion 3:1 (slice1; segments: 3) @@ -518,8 +521,8 @@ EXPLAIN (VERBOSE, COSTS OFF) -> Index Scan using t1_pkey on "S 1"."T 1" t2 Output: t2."C 1" Index Cond: (t2."C 1" = c1) - Optimizer: Pivotal Optimizer (GPORCA) - Settings: enable_hashjoin = 'off', enable_mergejoin = 'on' + Settings: enable_hashjoin = 'off', enable_mergejoin = 'on', enable_nestloop = 'off' + Optimizer: GPORCA (22 rows) SELECT t1.c1, t2."C 1" FROM ft2 t1 JOIN "S 1"."T 1" t2 ON (t1.c1 = t2."C 1") order by t1.c1 OFFSET 100 LIMIT 10; @@ -541,8 +544,8 @@ SELECT t1.c1, t2."C 1" FROM ft2 t1 JOIN "S 1"."T 1" t2 ON (t1.c1 = t2."C 1") ord -- list but no output change as compared to the previous query EXPLAIN (VERBOSE, COSTS OFF) SELECT t1.c1, t2."C 1" FROM ft2 t1 LEFT JOIN "S 1"."T 1" t2 ON (t1.c1 = t2."C 1") order by t1.c1 OFFSET 100 LIMIT 10; - QUERY PLAN ---------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------- Limit Output: c1, t2."C 1" -> Gather Motion 3:1 (slice1; segments: 3) @@ -563,8 +566,8 @@ EXPLAIN (VERBOSE, COSTS OFF) -> Index Scan using t1_pkey on "S 1"."T 1" t2 Output: t2."C 1" Index Cond: (t2."C 1" = c1) - Optimizer: Pivotal Optimizer (GPORCA) - Settings: enable_hashjoin = 'off', enable_mergejoin = 'on' + Settings: enable_hashjoin = 'off', enable_mergejoin = 'on', enable_nestloop = 'off' + Optimizer: GPORCA (22 rows) SELECT t1.c1, t2."C 1" FROM ft2 t1 LEFT JOIN "S 1"."T 1" t2 ON (t1.c1 = t2."C 1") order by t1.c1 OFFSET 100 LIMIT 10; @@ -621,8 +624,8 @@ EXPLAIN (VERBOSE, COSTS OFF) -> Foreign Scan on public.ft2 t3 Output: c1 Remote SQL: SELECT "C 1" FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) - Settings: enable_hashjoin = 'off', enable_mergejoin = 'on' + Settings: enable_hashjoin = 'off', enable_mergejoin = 'on', enable_nestloop = 'off' + Optimizer: GPORCA (35 rows) SELECT t1."C 1" FROM "S 1"."T 1" t1 left join ft1 t2 join ft2 t3 on (t2.c1 = t3.c1) on (t3.c1 = t1."C 1") order by t1."C 1" OFFSET 100 LIMIT 10; @@ -685,8 +688,8 @@ EXPLAIN (VERBOSE, COSTS OFF) -> Foreign Scan on public.ft1 t2 Output: c1 Remote SQL: SELECT "C 1" FROM "S 1"."T 1" + Settings: enable_hashjoin = 'off', enable_mergejoin = 'on', enable_nestloop = 'off' Optimizer: GPORCA - Settings: enable_hashjoin = 'off', enable_mergejoin = 'on' (40 rows) SELECT t1."C 1", t2.c1, t3.c1 FROM "S 1"."T 1" t1 left join ft1 t2 full join ft2 t3 on (t2.c1 = t3.c1) on (t3.c1 = t1."C 1") order by t1."C 1" OFFSET 100 LIMIT 10; @@ -745,8 +748,8 @@ EXPLAIN (VERBOSE, COSTS OFF) Output: t1."C 1" -> Seq Scan on "S 1"."T 1" t1 Output: t1."C 1" + Settings: enable_hashjoin = 'off', enable_mergejoin = 'on', enable_nestloop = 'off' Optimizer: GPORCA - Settings: enable_hashjoin = 'off', enable_mergejoin = 'on' (38 rows) SELECT t1."C 1", t2.c1, t3.c1 FROM "S 1"."T 1" t1 full join ft1 t2 full join ft2 t3 on (t2.c1 = t3.c1) on (t3.c1 = t1."C 1") order by t1."C 1" OFFSET 100 LIMIT 10; @@ -776,7 +779,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 1; -- Va Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (("C 1" = 1)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 100 AND t1.c2 = 0; -- BoolExpr @@ -785,16 +788,16 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE t1.c1 = 100 AND t1.c2 = Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE ((("C 1" = 100) AND (c2 = 0))) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NULL; -- NullTest - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Result Output: NULL::integer, NULL::integer, NULL::text, NULL::timestamp with time zone, NULL::timestamp without time zone, NULL::character varying(10), NULL::character(10), NULL::user_enum One-Time Filter: false - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NOT NULL; -- NullTest @@ -803,7 +806,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NOT NULL; -- Nu Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE ((NOT ("C 1" IS NULL))) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE round(abs(c1), 0) = 1; -- FuncExpr @@ -812,7 +815,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE round(abs(c1), 0) = 1; - Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE ((round(abs("C 1"), 0) = 1::numeric)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = -c1; -- OpExpr(l) @@ -821,16 +824,16 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = -c1; -- Op Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (("C 1" = (- "C 1"))) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) -EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE 1 = c1!; -- OpExpr(r) - QUERY PLAN ----------------------------------------------------------------------------------------------------------- +EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE 1 = c1; -- OpExpr(r) + QUERY PLAN +--------------------------------------------------------------------------------------------- Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 - Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE ((1::numeric = ("C 1" !))) - Optimizer: Pivotal Optimizer (GPORCA) + Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (("C 1" = 1)) + Optimizer: GPORCA (4 rows) EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE (c1 IS NOT NULL) IS DISTINCT FROM (c1 IS NOT NULL); -- DistinctExpr @@ -839,7 +842,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE (c1 IS NOT NULL) IS DIST Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (((NOT ("C 1" IS NULL)) IS DISTINCT FROM (NOT ("C 1" IS NULL)))) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = ANY(ARRAY[c2, 1, c1 + 0]); -- ScalarArrayOpExpr @@ -848,7 +851,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = ANY(ARRAY[c2, 1, c1 Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (("C 1" = ANY (ARRAY[c2, 1, ("C 1" + 0)]))) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = (ARRAY[c1,c2,3])[1]; -- SubscriptingRef @@ -857,7 +860,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = (ARRAY[c1,c2,3])[1] Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (("C 1" = ((ARRAY["C 1", c2, 3])[1]))) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c6 = E'foo''s\\bar'; -- check special chars @@ -866,7 +869,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c6 = E'foo''s\\bar'; -- Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE ((c6 = E'foo''s\\bar'::text)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c8 = 'foo'; -- can't be sent to remote @@ -876,14 +879,14 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c8 = 'foo'; -- can't be Output: c1, c2, c3, c4, c5, c6, c7, c8 Filter: (t1.c8 = 'foo'::user_enum) Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (5 rows) -- parameterized remote path for foreign table EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM "S 1"."T 1" a, ft2 b WHERE a."C 1" = 47 AND b.c1 = a.c2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------- Hash Join Output: a."C 1", a.c2, a.c3, a.c4, a.c5, a.c6, a.c7, a.c8, c1, c2, c3, c4, c5, c6, c7, c8 Hash Cond: (c1 = a.c2) @@ -897,7 +900,7 @@ EXPLAIN (VERBOSE, COSTS OFF) -> Index Scan using t1_pkey on "S 1"."T 1" a Output: a."C 1", a.c2, a.c3, a.c4, a.c5, a.c6, a.c7, a.c8 Index Cond: (a."C 1" = 47) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (14 rows) SELECT * FROM ft2 a, ft2 b WHERE a.c1 = 47 AND b.c1 = a.c2; @@ -910,8 +913,8 @@ SELECT * FROM ft2 a, ft2 b WHERE a.c1 = 47 AND b.c1 = a.c2; EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft2 a, ft2 b WHERE a.c2 = 6 AND b.c1 = a.c1 AND a.c8 = 'foo' AND b.c7 = upper(a.c7); - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------- Hash Join Output: a.c1, a.c2, a.c3, a.c4, a.c5, a.c6, a.c7, a.c8, b.c1, b.c2, b.c3, b.c4, b.c5, b.c6, b.c7, b.c8 Hash Cond: ((a.c1 = b.c1) AND (upper((a.c7)::text) = (b.c7)::text)) @@ -924,7 +927,7 @@ EXPLAIN (VERBOSE, COSTS OFF) -> Foreign Scan on public.ft2 b Output: b.c1, b.c2, b.c3, b.c4, b.c5, b.c6, b.c7, b.c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (13 rows) SELECT * FROM ft2 a, ft2 b @@ -1070,7 +1073,7 @@ EXPLAIN (VERBOSE, COSTS OFF) -> Foreign Scan on public.ft2 Output: c1, c2, c3, c4, c5, c6, c7, c8, random() Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (9 rows) EXPLAIN (VERBOSE, COSTS OFF) @@ -1103,14 +1106,14 @@ CREATE OPERATOR === ( -- built-in operators and functions can be shipped for remote execution EXPLAIN (VERBOSE, COSTS OFF) SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = abs(t1.c2); - QUERY PLAN + QUERY PLAN -------------------------------------------------------------------------- Aggregate Output: count(c3) -> Foreign Scan on public.ft1 t1 Output: c3 Remote SQL: SELECT c3 FROM "S 1"."T 1" WHERE (("C 1" = abs(c2))) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (6 rows) SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = abs(t1.c2); @@ -1121,14 +1124,14 @@ SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = abs(t1.c2); EXPLAIN (VERBOSE, COSTS OFF) SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = t1.c2; - QUERY PLAN + QUERY PLAN --------------------------------------------------------------------- Aggregate Output: count(c3) -> Foreign Scan on public.ft1 t1 Output: c3 Remote SQL: SELECT c3 FROM "S 1"."T 1" WHERE (("C 1" = c2)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (6 rows) SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = t1.c2; @@ -1140,7 +1143,7 @@ SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = t1.c2; -- by default, user-defined ones cannot EXPLAIN (VERBOSE, COSTS OFF) SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = postgres_fdw_abs(t1.c2); - QUERY PLAN + QUERY PLAN ----------------------------------------------------------- Aggregate Output: count(c3) @@ -1148,7 +1151,7 @@ EXPLAIN (VERBOSE, COSTS OFF) Output: c3 Filter: (t1.c1 = postgres_fdw_abs(t1.c2)) Remote SQL: SELECT "C 1", c2, c3 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (7 rows) SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = postgres_fdw_abs(t1.c2); @@ -1159,7 +1162,7 @@ SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = postgres_fdw_abs(t1.c2); EXPLAIN (VERBOSE, COSTS OFF) SELECT count(c3) FROM ft1 t1 WHERE t1.c1 === t1.c2; - QUERY PLAN + QUERY PLAN ----------------------------------------------------------- Aggregate Output: count(c3) @@ -1167,7 +1170,7 @@ EXPLAIN (VERBOSE, COSTS OFF) Output: c3 Filter: (t1.c1 === t1.c2) Remote SQL: SELECT "C 1", c2, c3 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (7 rows) SELECT count(c3) FROM ft1 t1 WHERE t1.c1 === t1.c2; @@ -1190,7 +1193,7 @@ EXPLAIN (VERBOSE, COSTS OFF) Output: c1, c2, c3, c4, c5, c6, c7, c8 Filter: (t1.c1 === t1.c2) Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (10 rows) SELECT * FROM ft1 t1 WHERE t1.c1 === t1.c2 order by t1.c2 limit 1; @@ -1206,14 +1209,14 @@ ALTER SERVER pgserver OPTIONS (ADD extensions 'postgres_fdw'); -- ... now they can be shipped EXPLAIN (VERBOSE, COSTS OFF) SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = postgres_fdw_abs(t1.c2); - QUERY PLAN + QUERY PLAN ---------------------------------------------------------------------------------------------- Aggregate Output: count(c3) -> Foreign Scan on public.ft1 t1 Output: c3 Remote SQL: SELECT c3 FROM "S 1"."T 1" WHERE (("C 1" = public.postgres_fdw_abs(c2))) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (6 rows) SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = postgres_fdw_abs(t1.c2); @@ -1224,14 +1227,14 @@ SELECT count(c3) FROM ft1 t1 WHERE t1.c1 = postgres_fdw_abs(t1.c2); EXPLAIN (VERBOSE, COSTS OFF) SELECT count(c3) FROM ft1 t1 WHERE t1.c1 === t1.c2; - QUERY PLAN + QUERY PLAN ---------------------------------------------------------------------------------------- Aggregate Output: count(c3) -> Foreign Scan on public.ft1 t1 Output: c3 Remote SQL: SELECT c3 FROM "S 1"."T 1" WHERE (("C 1" OPERATOR(public.===) c2)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (6 rows) SELECT count(c3) FROM ft1 t1 WHERE t1.c1 === t1.c2; @@ -1253,7 +1256,7 @@ EXPLAIN (VERBOSE, COSTS OFF) -> Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (("C 1" OPERATOR(public.===) c2)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (9 rows) SELECT * FROM ft1 t1 WHERE t1.c1 === t1.c2 order by t1.c2 limit 1; @@ -1275,7 +1278,7 @@ WHERE c1 = 642 AND length(to_tsvector('custom_search'::regconfig, c3)) > 0; Foreign Scan on public.ft1 Output: c1, to_tsvector('custom_search'::regconfig, c3) Remote SQL: SELECT "C 1", c3 FROM "S 1"."T 1" WHERE ((("C 1" = 642) AND (length(to_tsvector('public.custom_search'::regconfig, c3)) > 0))) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) SELECT c1, to_tsvector('custom_search'::regconfig, c3) FROM ft1 @@ -1315,7 +1318,7 @@ SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c3, t -> Foreign Scan on public.ft2 t2 Output: t2.c1 Remote SQL: SELECT "C 1" FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (19 rows) SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10; @@ -1364,7 +1367,7 @@ SELECT t1.c1, t2.c2, t3.c3 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) JOIN ft4 t -> Foreign Scan on public.ft2 t2 Output: t2.c1, t2.c2 Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (27 rows) SELECT t1.c1, t2.c2, t3.c3 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) JOIN ft4 t3 ON (t3.c1 = t1.c1) ORDER BY t1.c3, t1.c1 OFFSET 10 LIMIT 10; @@ -1403,7 +1406,7 @@ SELECT t1.c1, t2.c1 FROM ft4 t1 LEFT JOIN ft5 t2 ON (t1.c1 = t2.c1) ORDER BY t1. -> Foreign Scan on public.ft5 t2 Output: t2.c1 Remote SQL: SELECT c1 FROM "S 1"."T 4" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (17 rows) SELECT t1.c1, t2.c1 FROM ft4 t1 LEFT JOIN ft5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10; @@ -1447,7 +1450,7 @@ SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 LEFT JOIN ft2 t2 ON (t1.c1 = t2.c1) LEFT -> Foreign Scan on public.ft2 t2 Output: t2.c1, t2.c2 Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (22 rows) SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 LEFT JOIN ft2 t2 ON (t1.c1 = t2.c1) LEFT JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10; @@ -1483,7 +1486,7 @@ SELECT t1.c1, t1.c2, t2.c1, t2.c2 FROM ft4 t1 LEFT JOIN (SELECT * FROM ft5 WHERE -> Foreign Scan on public.ft5 Output: ft5.c1, ft5.c2 Remote SQL: SELECT c1, c2 FROM "S 1"."T 4" WHERE ((c1 < 10)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (12 rows) SELECT t1.c1, t1.c2, t2.c1, t2.c2 FROM ft4 t1 LEFT JOIN (SELECT * FROM ft5 WHERE c1 < 10) t2 ON (t1.c1 = t2.c1) WHERE t1.c1 < 10; @@ -1516,7 +1519,7 @@ SELECT t1.c1, t1.c2, t2.c1, t2.c2 FROM ft4 t1 LEFT JOIN (SELECT * FROM ft5 WHERE -> Foreign Scan on public.ft5 Output: ft5.c1, ft5.c2 Remote SQL: SELECT c1, c2 FROM "S 1"."T 4" WHERE ((c1 < 10)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (15 rows) SELECT t1.c1, t1.c2, t2.c1, t2.c2 FROM ft4 t1 LEFT JOIN (SELECT * FROM ft5 WHERE c1 < 10) t2 ON (t1.c1 = t2.c1) @@ -1550,7 +1553,7 @@ SELECT t1.c1, t2.c1 FROM ft5 t1 RIGHT JOIN ft4 t2 ON (t1.c1 = t2.c1) ORDER BY t2 -> Foreign Scan on public.ft5 t1 Output: t1.c1 Remote SQL: SELECT c1 FROM "S 1"."T 4" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (17 rows) SELECT t1.c1, t2.c1 FROM ft5 t1 RIGHT JOIN ft4 t2 ON (t1.c1 = t2.c1) ORDER BY t2.c1, t1.c1 OFFSET 10 LIMIT 10; @@ -1594,7 +1597,7 @@ SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 RIGHT JOIN ft2 t2 ON (t1.c1 = t2.c1) RIGH -> Foreign Scan on public.ft2 t1 Output: t1.c1 Remote SQL: SELECT "C 1" FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (22 rows) SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 RIGHT JOIN ft2 t2 ON (t1.c1 = t2.c1) RIGHT JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10; @@ -1762,8 +1765,8 @@ SELECT t1.c1, ss.a, ss.b FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t1 -- c. test deparsing the remote query as nested subqueries EXPLAIN (VERBOSE, COSTS OFF) SELECT t1.c1, ss.a, ss.b FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t1 FULL JOIN (SELECT t2.c1, t3.c1 FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t2 FULL JOIN (SELECT c1 FROM ft5 WHERE c1 between 50 and 60) t3 ON (t2.c1 = t3.c1) WHERE t2.c1 IS NULL OR t2.c1 IS NOT NULL) ss(a, b) ON (t1.c1 = ss.a) ORDER BY t1.c1, ss.a, ss.b; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------ Sort Output: ft4_1.c1, ft4.c1, ft5.c1 Sort Key: ft4_1.c1, ft4.c1, ft5.c1 @@ -1850,7 +1853,7 @@ SELECT t1.c1, ss.a, ss.b FROM (SELECT c1 FROM "S 1"."T 3" WHERE c1 = 50) t1 INNE -> Index Scan using t3_pkey on "S 1"."T 3" Output: "T 3".c1 Index Cond: ("T 3".c1 = 50) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (41 rows) SELECT t1.c1, ss.a, ss.b FROM (SELECT c1 FROM "S 1"."T 3" WHERE c1 = 50) t1 INNER JOIN (SELECT t2.c1, t3.c1 FROM (SELECT c1 FROM ft4 WHERE c1 between 50 and 60) t2 FULL JOIN (SELECT c1 FROM ft5 WHERE c1 between 50 and 60) t3 ON (t2.c1 = t3.c1) WHERE t2.c1 IS NULL OR t2.c1 IS NOT NULL) ss(a, b) ON (TRUE) ORDER BY t1.c1, ss.a, ss.b FOR UPDATE OF t1; @@ -2159,7 +2162,7 @@ SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 RIGHT JOIN ft2 t2 ON (t1.c1 = t2.c1) LEFT -> Foreign Scan on public.ft2 t1 Output: t1.c1 Remote SQL: SELECT "C 1" FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (22 rows) SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 RIGHT JOIN ft2 t2 ON (t1.c1 = t2.c1) LEFT JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10; @@ -2203,7 +2206,7 @@ SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 LEFT JOIN ft2 t2 ON (t1.c1 = t2.c1) RIGHT -> Foreign Scan on public.ft2 t2 Output: t2.c1, t2.c2 Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (22 rows) SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 LEFT JOIN ft2 t2 ON (t1.c1 = t2.c1) RIGHT JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10; @@ -2462,7 +2465,7 @@ WITH t (c1_1, c1_3, c2_1) AS MATERIALIZED (SELECT t1.c1, t1.c3, t2.c1 FROM ft1 t -> Foreign Scan on public.ft2 t2 Output: t2.c1 Remote SQL: SELECT "C 1" FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (22 rows) WITH t (c1_1, c1_3, c2_1) AS MATERIALIZED (SELECT t1.c1, t1.c3, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1)) SELECT c1_1, c2_1 FROM t ORDER BY c1_3, c1_1 OFFSET 100 LIMIT 10; @@ -2517,8 +2520,8 @@ SELECT t1.c1 FROM ft1 t1 WHERE EXISTS (SELECT 1 FROM ft2 t2 WHERE t1.c1 = t2.c1) -> Foreign Scan on public.ft2 t2 Output: 1, t2.c1 Remote SQL: SELECT "C 1" FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) Settings: enable_mergejoin = 'on' + Optimizer: GPORCA (18 rows) SELECT t1.c1 FROM ft1 t1 WHERE EXISTS (SELECT 1 FROM ft2 t2 WHERE t1.c1 = t2.c1) ORDER BY t1.c1 OFFSET 100 LIMIT 10; @@ -2557,8 +2560,8 @@ SELECT t1.c1 FROM ft1 t1 WHERE NOT EXISTS (SELECT 1 FROM ft2 t2 WHERE t1.c1 = t2 -> Foreign Scan on public.ft2 t2 Output: 1, t2.c2 Remote SQL: SELECT c2 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) Settings: enable_mergejoin = 'on' + Optimizer: GPORCA (18 rows) SELECT t1.c1 FROM ft1 t1 WHERE NOT EXISTS (SELECT 1 FROM ft2 t2 WHERE t1.c1 = t2.c2) ORDER BY t1.c1 OFFSET 100 LIMIT 10; @@ -2597,8 +2600,8 @@ SELECT t1.c1, t2.c1 FROM ft1 t1 CROSS JOIN ft2 t2 ORDER BY t1.c1, t2.c1 OFFSET 1 -> Foreign Scan on public.ft2 t2 Output: t2.c1 Remote SQL: SELECT "C 1" FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) Settings: enable_mergejoin = 'on' + Optimizer: GPORCA (18 rows) SELECT t1.c1, t2.c1 FROM ft1 t1 CROSS JOIN ft2 t2 ORDER BY t1.c1, t2.c1 OFFSET 100 LIMIT 10; @@ -2637,8 +2640,8 @@ SELECT t1.c1, t2.c1 FROM ft5 t1 JOIN ft6 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t -> Foreign Scan on public.ft6 t2 Output: t2.c1 Remote SQL: SELECT c1 FROM "S 1"."T 4" - Optimizer: Pivotal Optimizer (GPORCA) Settings: enable_mergejoin = 'on' + Optimizer: GPORCA (18 rows) SELECT t1.c1, t2.c1 FROM ft5 t1 JOIN ft6 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 100 LIMIT 10; @@ -2668,8 +2671,8 @@ SELECT t1.c1, t2.c1 FROM ft1 t1 LEFT JOIN ft2 t2 ON (t1.c8 = t2.c8) ORDER BY t1. -> Foreign Scan on public.ft2 t2 Output: t2.c1, t2.c8 Remote SQL: SELECT "C 1", c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) Settings: enable_mergejoin = 'on' + Optimizer: GPORCA (18 rows) SELECT t1.c1, t2.c1 FROM ft1 t1 LEFT JOIN ft2 t2 ON (t1.c8 = t2.c8) ORDER BY t1.c1, t2.c1 OFFSET 100 LIMIT 10; @@ -2711,8 +2714,8 @@ SELECT t1.c1, t2.c1 FROM ft1 t1 LEFT JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE t1.c8 -> Foreign Scan on public.ft2 t2 Output: t2.c1 Remote SQL: SELECT "C 1" FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) Settings: enable_mergejoin = 'on' + Optimizer: GPORCA (21 rows) SELECT t1.c1, t2.c1 FROM ft1 t1 LEFT JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE t1.c8 = 'foo' ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10; @@ -2736,8 +2739,8 @@ SELECT t1.c1, t2.c1 FROM ft1 t1 LEFT JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE t1.c8 -- into one of the joining sides. EXPLAIN (VERBOSE, COSTS OFF) SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE t1.c8 = t2.c8 ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------- Result Output: t1.c1, t2.c1 -> Limit @@ -2756,8 +2759,8 @@ SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE t1.c8 = t2. -> Foreign Scan on public.ft2 t2 Output: t2.c1, t2.c8 Remote SQL: SELECT "C 1", c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) Settings: enable_mergejoin = 'on' + Optimizer: GPORCA (20 rows) SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE t1.c8 = t2.c8 ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10; @@ -2814,8 +2817,8 @@ SELECT t1c1, avg(t1c1 + t2c1) FROM (SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 -> Foreign Scan on public.ft2 t2_1 Output: t2_1.c1 Remote SQL: SELECT "C 1" FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) Settings: enable_mergejoin = 'on' + Optimizer: GPORCA (36 rows) SELECT t1c1, avg(t1c1 + t2c1) FROM (SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) UNION SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1)) AS t (t1c1, t2c1) GROUP BY t1c1 ORDER BY t1c1 OFFSET 100 LIMIT 10; @@ -2838,8 +2841,8 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT t1."C 1" FROM "S 1"."T 1" t1, LATERAL (SELECT DISTINCT t2.c1, t3.c1 FROM ft1 t2, ft2 t3 WHERE t2.c1 = t3.c1 AND t2.c2 = t1.c2) q ORDER BY t1."C 1" OFFSET 10 LIMIT 10; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: LATERAL - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit Output: t1."C 1" -> Nested Loop @@ -2850,17 +2853,20 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support -> Index Scan using t1_pkey on "S 1"."T 1" t1 Output: t1."C 1", t1.c2 -> Materialize - Output: t2.c1, t3.c1 - -> HashAggregate - Output: t2.c1, t3.c1 - Group Key: t2.c1, t3.c1 - -> Foreign Scan - Output: t2.c1, t3.c1 - Relations: (public.ft1 t2) INNER JOIN (public.ft2 t3) - Remote SQL: SELECT r1."C 1", r2."C 1" FROM ("S 1"."T 1" r1 INNER JOIN "S 1"."T 1" r2 ON (((r1."C 1" = r2."C 1")) AND ((r1.c2 = $1::integer)))) - Optimizer: Postgres query optimizer + -> Memoize + Cache Key: t1.c2 + Cache Mode: binary + -> Subquery Scan on q + -> HashAggregate + Output: t2.c1, t3.c1 + Group Key: t2.c1, t3.c1 + -> Foreign Scan + Output: t2.c1, t3.c1 + Relations: (public.ft1 t2) INNER JOIN (public.ft2 t3) + Remote SQL: SELECT r1."C 1", r2."C 1" FROM ("S 1"."T 1" r1 INNER JOIN "S 1"."T 1" r2 ON (((r1."C 1" = r2."C 1")) AND ((r1.c2 = $1::integer)))) Settings: enable_mergejoin = 'on' -(20 rows) + Optimizer: Postgres query optimizer +(23 rows) SELECT t1."C 1" FROM "S 1"."T 1" t1, LATERAL (SELECT DISTINCT t2.c1, t3.c1 FROM ft1 t2, ft2 t3 WHERE t2.c1 = t3.c1 AND t2.c2 = t1.c2) q ORDER BY t1."C 1" OFFSET 10 LIMIT 10; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -2901,7 +2907,7 @@ SELECT q.a, ft2.c1 FROM (SELECT 13 FROM ft1 WHERE c1 = 13) q(a) RIGHT JOIN ft2 O -> Foreign Scan on public.ft1 Output: 13 Remote SQL: SELECT NULL FROM "S 1"."T 1" WHERE (("C 1" = 13)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (15 rows) SELECT q.a, ft2.c1 FROM (SELECT 13 FROM ft1 WHERE c1 = 13) q(a) RIGHT JOIN ft2 ON (q.a = ft2.c1) WHERE ft2.c1 BETWEEN 10 AND 15; @@ -2939,7 +2945,7 @@ SELECT ft4.c1, q.* FROM ft4 LEFT JOIN (SELECT 13, ft1.c1, ft2.c1 FROM ft1 RIGHT -> Foreign Scan on public.ft1 Output: ft1.c1 Remote SQL: SELECT "C 1" FROM "S 1"."T 1" WHERE (("C 1" = 12)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (20 rows) SELECT ft4.c1, q.* FROM ft4 LEFT JOIN (SELECT 13, ft1.c1, ft2.c1 FROM ft1 RIGHT JOIN ft2 ON (ft1.c1 = ft2.c1) WHERE ft1.c1 = 12) q(a, b, c) ON (ft4.c1 = q.b) WHERE ft4.c1 BETWEEN 10 AND 15; @@ -3049,8 +3055,8 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Remote SQL: SELECT c1, c2, c3 FROM "S 1"."T 4" FOR UPDATE -> Index Scan using local_tbl_pkey on public.local_tbl Output: local_tbl.c1, local_tbl.c2, local_tbl.c3, local_tbl.ctid + Settings: enable_hashjoin = 'off', enable_mergejoin = 'on', enable_nestloop = 'off' Optimizer: Postgres query optimizer - Settings: enable_hashjoin = 'off', enable_mergejoin = 'on' (52 rows) SELECT * FROM ft1, ft2, ft4, ft5, local_tbl WHERE ft1.c1 = ft2.c1 AND ft1.c2 = ft4.c1 @@ -3107,7 +3113,7 @@ SELECT t1.c1, t2.c2 FROM v4 t1 LEFT JOIN v5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1 -> Foreign Scan on public.ft5 Output: ft5.c1, ft5.c2 Remote SQL: SELECT c1, c2 FROM "S 1"."T 4" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (19 rows) SELECT t1.c1, t2.c2 FROM v4 t1 LEFT JOIN v5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10; @@ -3148,7 +3154,7 @@ SELECT t1.c1, t2.c2 FROM v4 t1 LEFT JOIN v5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1 -> Foreign Scan on public.ft5 Output: ft5.c1, ft5.c2 Remote SQL: SELECT c1, c2 FROM "S 1"."T 4" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (19 rows) SELECT t1.c1, t2.c2 FROM v4 t1 LEFT JOIN v5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10; @@ -3188,7 +3194,7 @@ SELECT t1.c1, t2.c2 FROM v4 t1 LEFT JOIN ft5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c -> Foreign Scan on public.ft5 t2 Output: t2.c1, t2.c2 Remote SQL: SELECT c1, c2 FROM "S 1"."T 4" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (19 rows) SELECT t1.c1, t2.c2 FROM v4 t1 LEFT JOIN ft5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10; @@ -3229,7 +3235,7 @@ SELECT t1.c1, t2.c2 FROM v4 t1 LEFT JOIN ft5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c -> Foreign Scan on public.ft5 t2 Output: t2.c1, t2.c2 Remote SQL: SELECT c1, c2 FROM "S 1"."T 4" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (19 rows) SELECT t1.c1, t2.c2 FROM v4 t1 LEFT JOIN ft5 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10; @@ -3257,10 +3263,10 @@ DROP ROLE regress_view_owner; -- Simple aggregates explain (verbose, costs off) select count(c6), sum(c1), avg(c1), min(c2), max(c1), stddev(c2), sum(c1) * (random() <= 1)::int as sum2 from ft1 where c2 < 5 group by c2 order by 1, 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------- Result - Output: (count(c6)), (sum(c1)), (avg(c1)), (min(c2)), (max(c1)), (stddev(c2)), ((sum(c1)) * int4((random() <= '1'::double precision))) + Output: (count(c6)), (sum(c1)), (avg(c1)), (min(c2)), (max(c1)), (stddev(c2)), ((sum(c1)) * ((random() <= '1'::double precision))::integer) -> Sort Output: (count(c6)), (sum(c1)), (avg(c1)), (min(c2)), (max(c1)), (stddev(c2)), (sum(c1)), c2 Sort Key: (count(ft1.c6)), (sum(ft1.c1)) @@ -3270,7 +3276,7 @@ select count(c6), sum(c1), avg(c1), min(c2), max(c1), stddev(c2), sum(c1) * (ran -> Foreign Scan on public.ft1 Output: c1, c2, c6 Remote SQL: SELECT "C 1", c2, c6 FROM "S 1"."T 1" WHERE ((c2 < 5)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (12 rows) select count(c6), sum(c1), avg(c1), min(c2), max(c1), stddev(c2), sum(c1) * (random() <= 1)::int as sum2 from ft1 where c2 < 5 group by c2 order by 1, 2; @@ -3285,12 +3291,12 @@ select count(c6), sum(c1), avg(c1), min(c2), max(c1), stddev(c2), sum(c1) * (ran explain (verbose, costs off) select count(c6), sum(c1), avg(c1), min(c2), max(c1), stddev(c2), sum(c1) * (random() <= 1)::int as sum2 from ft1 where c2 < 5 group by c2 order by 1, 2 limit 1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------- Limit - Output: (count(c6)), (sum(c1)), (avg(c1)), (min(c2)), (max(c1)), (stddev(c2)), (((sum(c1)) * int4((random() <= '1'::double precision)))) + Output: (count(c6)), (sum(c1)), (avg(c1)), (min(c2)), (max(c1)), (stddev(c2)), (((sum(c1)) * ((random() <= '1'::double precision))::integer)) -> Result - Output: (count(c6)), (sum(c1)), (avg(c1)), (min(c2)), (max(c1)), (stddev(c2)), ((sum(c1)) * int4((random() <= '1'::double precision))) + Output: (count(c6)), (sum(c1)), (avg(c1)), (min(c2)), (max(c1)), (stddev(c2)), ((sum(c1)) * ((random() <= '1'::double precision))::integer) -> Sort Output: (count(c6)), (sum(c1)), (avg(c1)), (min(c2)), (max(c1)), (stddev(c2)), (sum(c1)), c2 Sort Key: (count(ft1.c6)), (sum(ft1.c1)) @@ -3300,7 +3306,7 @@ select count(c6), sum(c1), avg(c1), min(c2), max(c1), stddev(c2), sum(c1) * (ran -> Foreign Scan on public.ft1 Output: c1, c2, c6 Remote SQL: SELECT "C 1", c2, c6 FROM "S 1"."T 1" WHERE ((c2 < 5)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (14 rows) select count(c6), sum(c1), avg(c1), min(c2), max(c1), stddev(c2), sum(c1) * (random() <= 1)::int as sum2 from ft1 where c2 < 5 group by c2 order by 1, 2 limit 1; @@ -3312,20 +3318,20 @@ select count(c6), sum(c1), avg(c1), min(c2), max(c1), stddev(c2), sum(c1) * (ran -- Aggregate is not pushed down as aggregation contains random() explain (verbose, costs off) select sum(c1 * (random() <= 1)::int) as sum, avg(c1) from ft1; - QUERY PLAN --------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------- Aggregate - Output: sum((c1 * int4((random() <= '1'::double precision)))), avg(c1) + Output: sum((c1 * ((random() <= '1'::double precision))::integer)), avg(c1) -> Foreign Scan on public.ft1 Output: c1 Remote SQL: SELECT "C 1" FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (6 rows) -- Aggregate over join query explain (verbose, costs off) select count(*), sum(t1.c1), avg(t2.c1) from ft1 t1 inner join ft1 t2 on (t1.c2 = t2.c2) where t1.c2 = 6; - QUERY PLAN + QUERY PLAN ------------------------------------------------------------------------------------ Aggregate Output: count(*), sum(t1.c1), avg(t2.c1) @@ -3340,7 +3346,7 @@ select count(*), sum(t1.c1), avg(t2.c1) from ft1 t1 inner join ft1 t2 on (t1.c2 -> Foreign Scan on public.ft1 t2 Output: t2.c1, t2.c2 Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE ((c2 = 6)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (14 rows) select count(*), sum(t1.c1), avg(t2.c1) from ft1 t1 inner join ft1 t2 on (t1.c2 = t2.c2) where t1.c2 = 6; @@ -3352,8 +3358,8 @@ select count(*), sum(t1.c1), avg(t2.c1) from ft1 t1 inner join ft1 t2 on (t1.c2 -- Not pushed down due to local conditions present in underneath input rel explain (verbose, costs off) select sum(t1.c1), count(t2.c1) from ft1 t1 inner join ft2 t2 on (t1.c1 = t2.c1) where ((t1.c1 * t2.c1)/(t1.c1 * t2.c1)) * random() <= 1; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------- Aggregate Output: sum(t1.c1), count(t2.c1) -> Hash Join @@ -3368,7 +3374,7 @@ select sum(t1.c1), count(t2.c1) from ft1 t1 inner join ft2 t2 on (t1.c1 = t2.c1) -> Foreign Scan on public.ft2 t2 Output: t2.c1 Remote SQL: SELECT "C 1" FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (15 rows) -- GROUP BY clause having expressions @@ -3387,7 +3393,7 @@ select c2/2, sum(c2) * (c2/2) from ft1 group by c2/2 order by c2/2; -> Foreign Scan on public.ft1 Output: (c2 / 2), c2 Remote SQL: SELECT c2 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (12 rows) select c2/2, sum(c2) * (c2/2) from ft1 group by c2/2 order by c2/2; @@ -3403,7 +3409,7 @@ select c2/2, sum(c2) * (c2/2) from ft1 group by c2/2 order by c2/2; -- Aggregates in subquery are pushed down. explain (verbose, costs off) select count(x.a), sum(x.a) from (select c2 a, sum(c1) b from ft1 group by c2, sqrt(c1) order by 1, 2) x; - QUERY PLAN + QUERY PLAN ------------------------------------------------------------- Aggregate Output: count(c2), sum(c2) @@ -3413,7 +3419,7 @@ select count(x.a), sum(x.a) from (select c2 a, sum(c1) b from ft1 group by c2, s -> Foreign Scan on public.ft1 Output: sqrt((c1)::double precision), c2 Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (9 rows) select count(x.a), sum(x.a) from (select c2 a, sum(c1) b from ft1 group by c2, sqrt(c1) order by 1, 2) x; @@ -3425,18 +3431,18 @@ select count(x.a), sum(x.a) from (select c2 a, sum(c1) b from ft1 group by c2, s -- Aggregate is still pushed down by taking unshippable expression out explain (verbose, costs off) select c2 * (random() <= 1)::int as sum1, sum(c1) * c2 as sum2 from ft1 group by c2 order by 1, 2; - QUERY PLAN ----------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------- Sort - Output: ((c2 * int4((random() <= '1'::double precision)))), ((sum(c1) * c2)) - Sort Key: ((ft1.c2 * int4((random() <= '1'::double precision)))), ((sum(ft1.c1) * ft1.c2)) + Output: ((c2 * ((random() <= '1'::double precision))::integer)), ((sum(c1) * c2)) + Sort Key: ((ft1.c2 * ((random() <= '1'::double precision))::integer)), ((sum(ft1.c1) * ft1.c2)) -> HashAggregate - Output: (c2 * int4((random() <= '1'::double precision))), (sum(c1) * c2) + Output: (c2 * ((random() <= '1'::double precision))::integer), (sum(c1) * c2) Group Key: ft1.c2 -> Foreign Scan on public.ft1 Output: c1, c2 Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (10 rows) select c2 * (random() <= 1)::int as sum1, sum(c1) * c2 as sum2 from ft1 group by c2 order by 1, 2; @@ -3457,18 +3463,18 @@ select c2 * (random() <= 1)::int as sum1, sum(c1) * c2 as sum2 from ft1 group by -- Aggregate with unshippable GROUP BY clause are not pushed explain (verbose, costs off) select c2 * (random() <= 1)::int as c2 from ft2 group by c2 * (random() <= 1)::int order by 1; - QUERY PLAN --------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------- GroupAggregate - Output: ((c2 * int4((random() <= '1'::double precision)))) - Group Key: ((ft2.c2 * int4((random() <= '1'::double precision)))) + Output: ((c2 * ((random() <= '1'::double precision))::integer)) + Group Key: ((ft2.c2 * ((random() <= '1'::double precision))::integer)) -> Sort - Output: ((c2 * int4((random() <= '1'::double precision)))) - Sort Key: ((ft2.c2 * int4((random() <= '1'::double precision)))) + Output: ((c2 * ((random() <= '1'::double precision))::integer)) + Sort Key: ((ft2.c2 * ((random() <= '1'::double precision))::integer)) -> Foreign Scan on public.ft2 - Output: (c2 * int4((random() <= '1'::double precision))) + Output: (c2 * ((random() <= '1'::double precision))::integer) Remote SQL: SELECT c2 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (10 rows) -- GROUP BY clause in various forms, cardinal, alias and constant expression @@ -3487,7 +3493,7 @@ select count(c2) w, c2 x, 5 y, 7.0 z from ft1 group by 2, y, 9.0::int order by 2 -> Foreign Scan on public.ft1 Output: 5, 9, c2 Remote SQL: SELECT c2 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (12 rows) select count(c2) w, c2 x, 5 y, 7.0 z from ft1 group by 2, y, 9.0::int order by 2; @@ -3522,7 +3528,7 @@ select c2, c2 from ft1 where c2 > 6 group by 1, 2 order by sum(c1); -> Foreign Scan on public.ft1 Output: c1, c2 Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE ((c2 > 6)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (12 rows) select c2, c2 from ft1 where c2 > 6 group by 1, 2 order by sum(c1); @@ -3553,7 +3559,7 @@ select c2, sum(c1) from ft2 group by c2 having avg(c1) < 500 and sum(c1) < 49800 -> Foreign Scan on public.ft2 Output: c1, c2 Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (16 rows) select c2, sum(c1) from ft2 group by c2 having avg(c1) < 500 and sum(c1) < 49800 order by c2; @@ -3566,7 +3572,7 @@ select c2, sum(c1) from ft2 group by c2 having avg(c1) < 500 and sum(c1) < 49800 -- Unshippable HAVING clause will be evaluated locally, and other qual in HAVING clause is pushed down explain (verbose, costs off) select count(*) from (select c5, count(c1) from ft1 group by c5, sqrt(c2) having (avg(c1) / avg(c1)) * random() <= 1 and avg(c1) < 500) x; - QUERY PLAN + QUERY PLAN ------------------------------------------------------------------------------------------------------------- Aggregate Output: count(*) @@ -3581,7 +3587,7 @@ select count(*) from (select c5, count(c1) from ft1 group by c5, sqrt(c2) having -> Foreign Scan on public.ft1 Output: sqrt((c2)::double precision), c1, c5 Remote SQL: SELECT "C 1", c2, c5 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (14 rows) select count(*) from (select c5, count(c1) from ft1 group by c5, sqrt(c2) having (avg(c1) / avg(c1)) * random() <= 1 and avg(c1) < 500) x; @@ -3593,21 +3599,21 @@ select count(*) from (select c5, count(c1) from ft1 group by c5, sqrt(c2) having -- Aggregate in HAVING clause is not pushable, and thus aggregation is not pushed down explain (verbose, costs off) select sum(c1) from ft1 group by c2 having avg(c1 * (random() <= 1)::int) > 100 order by 1; - QUERY PLAN ------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------- Sort Output: (sum(c1)) Sort Key: (sum(ft1.c1)) -> Result Output: (sum(c1)) - Filter: ((avg((ft1.c1 * int4((random() <= '1'::double precision))))) > '100'::numeric) + Filter: ((avg((ft1.c1 * ((random() <= '1'::double precision))::integer))) > '100'::numeric) -> HashAggregate - Output: sum(c1), avg((c1 * int4((random() <= '1'::double precision)))), c2 + Output: sum(c1), avg((c1 * ((random() <= '1'::double precision))::integer)), c2 Group Key: ft1.c2 -> Foreign Scan on public.ft1 Output: c1, c2 Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (13 rows) -- Remote aggregate in combination with a local Param (for the output @@ -3615,7 +3621,7 @@ select sum(c1) from ft1 group by c2 having avg(c1 * (random() <= 1)::int) > 100 explain (verbose, costs off) select exists(select 1 from pg_enum), sum(c1) from ft1; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables QUERY PLAN -------------------------------------------------- Foreign Scan @@ -3630,7 +3636,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support select exists(select 1 from pg_enum), sum(c1) from ft1; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables exists | sum --------+-------- t | 500500 @@ -3639,7 +3645,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support explain (verbose, costs off) select exists(select 1 from pg_enum), sum(c1) from ft1 group by 1; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables QUERY PLAN --------------------------------------------------- GroupAggregate @@ -3656,7 +3662,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support select exists(select 1 from pg_enum), sum(c1) from ft1 group by 1; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables exists | sum --------+-------- t | 500500 @@ -3704,7 +3710,7 @@ select array_agg(c5 order by c1 desc) from ft2 where c2 = 6 and c1 < 50; -> Foreign Scan on public.ft2 Output: c1, c5 Remote SQL: SELECT "C 1", c5 FROM "S 1"."T 1" WHERE (((c2 = 6) AND ("C 1" < 50))) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (6 rows) select array_agg(c5 order by c1 desc) from ft2 where c2 = 6 and c1 < 50; @@ -3716,8 +3722,8 @@ select array_agg(c5 order by c1 desc) from ft2 where c2 = 6 and c1 < 50; -- DISTINCT within aggregate explain (verbose, costs off) select array_agg(distinct (t1.c1)%5) from ft4 t1 full join ft5 t2 on (t1.c1 = t2.c1) where t1.c1 < 20 or (t1.c1 is null and t2.c1 < 5) group by (t2.c1)%3 order by 1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- Result Output: (array_agg(DISTINCT (t1.c1 % 5))) -> Sort @@ -3756,8 +3762,8 @@ select array_agg(distinct (t1.c1)%5) from ft4 t1 full join ft5 t2 on (t1.c1 = t2 -- DISTINCT combined with ORDER BY within aggregate explain (verbose, costs off) select array_agg(distinct (t1.c1)%5 order by (t1.c1)%5) from ft4 t1 full join ft5 t2 on (t1.c1 = t2.c1) where t1.c1 < 20 or (t1.c1 is null and t2.c1 < 5) group by (t2.c1)%3 order by 1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- Result Output: (array_agg(DISTINCT (t1.c1 % 5) ORDER BY (t1.c1 % 5))) -> Sort @@ -3795,8 +3801,8 @@ select array_agg(distinct (t1.c1)%5 order by (t1.c1)%5) from ft4 t1 full join ft explain (verbose, costs off) select array_agg(distinct (t1.c1)%5 order by (t1.c1)%5 desc nulls last) from ft4 t1 full join ft5 t2 on (t1.c1 = t2.c1) where t1.c1 < 20 or (t1.c1 is null and t2.c1 < 5) group by (t2.c1)%3 order by 1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- Result Output: (array_agg(DISTINCT (t1.c1 % 5) ORDER BY (t1.c1 % 5) DESC NULLS LAST)) -> Sort @@ -3890,24 +3896,18 @@ explain (verbose, costs off) select distinct (select count(*) filter (where t2.c2 = 6 and t2.c1 < 10) from ft1 t1 where t1.c1 = 6) from ft2 t2 where t2.c2 % 6 = 0 order by 1; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Aggregate functions with FILTER - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------- - Unique - Output: ((SubPlan 1)) - Group Key: ((SubPlan 1)) - -> Sort - Output: ((SubPlan 1)) - Sort Key: ((SubPlan 1)) - -> Foreign Scan - Output: (SubPlan 1) - Relations: Aggregate on (public.ft2 t2) - Remote SQL: SELECT count(*) FILTER (WHERE ((c2 = 6) AND ("C 1" < 10))) FROM "S 1"."T 1" WHERE (((c2 % 6) = 0)) - SubPlan 1 - -> Foreign Scan on public.ft1 t1 - Output: (count(*) FILTER (WHERE ((t2.c2 = 6) AND (t2.c1 < 10)))) - Remote SQL: SELECT NULL FROM "S 1"."T 1" WHERE (("C 1" = 6)) + QUERY PLAN +------------------------------------------------------------------------------------------------------------------ + Foreign Scan + Output: (SubPlan 1) + Relations: Aggregate on (public.ft2 t2) + Remote SQL: SELECT count(*) FILTER (WHERE ((c2 = 6) AND ("C 1" < 10))) FROM "S 1"."T 1" WHERE (((c2 % 6) = 0)) + SubPlan 1 + -> Foreign Scan on public.ft1 t1 + Output: (count(*) FILTER (WHERE ((t2.c2 = 6) AND (t2.c1 < 10)))) + Remote SQL: SELECT NULL FROM "S 1"."T 1" WHERE (("C 1" = 6)) Optimizer: Postgres query optimizer -(15 rows) +(9 rows) select distinct (select count(*) filter (where t2.c2 = 6 and t2.c1 < 10) from ft1 t1 where t1.c1 = 6) from ft2 t2 where t2.c2 % 6 = 0 order by 1; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -4007,7 +4007,7 @@ select c2, rank('10'::varchar) within group (order by c6), percentile_cont(c2/10 -> Foreign Scan on public.ft1 Output: c1, c2, c6 Remote SQL: SELECT "C 1", c2, c6 FROM "S 1"."T 1" WHERE ((c2 < 10)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (16 rows) select c2, rank('10'::varchar) within group (order by c6), percentile_cont(c2/10::numeric) within group (order by c1) from ft1 where c2 < 10 group by c2 having percentile_cont(c2/10::numeric) within group (order by c1) < 500 order by c2; @@ -4034,7 +4034,7 @@ select c1, rank(c1, c2) within group (order by c1, c2) from ft1 group by c1, c2 -> Foreign Scan on public.ft1 Output: c1, c2 Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE (("C 1" = 6)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (10 rows) select c1, rank(c1, c2) within group (order by c1, c2) from ft1 group by c1, c2 having c1 = 6 order by 1; @@ -4066,8 +4066,8 @@ select c2, least_agg(c1) from ft1 group by c2 order by c2; -> Foreign Scan on public.ft1 Output: c1, c2 Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) Settings: enable_hashagg = 'off' + Optimizer: GPORCA (11 rows) -- Add function and aggregate into extension @@ -4088,8 +4088,8 @@ select c2, least_agg(c1) from ft1 where c2 < 100 group by c2 order by c2; -> Foreign Scan on public.ft1 Output: c1, c2 Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE ((c2 < 100)) - Optimizer: Pivotal Optimizer (GPORCA) Settings: enable_hashagg = 'off' + Optimizer: GPORCA (11 rows) select c2, least_agg(c1) from ft1 where c2 < 100 group by c2 order by c2; @@ -4125,8 +4125,8 @@ select c2, least_agg(c1) from ft1 group by c2 order by c2; -> Foreign Scan on public.ft1 Output: c1, c2 Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) Settings: enable_hashagg = 'off' + Optimizer: GPORCA (11 rows) -- Cleanup @@ -4176,7 +4176,7 @@ select array_agg(c1 order by c1 using operator(public.<^)) from ft2 where c2 = 6 -> Foreign Scan on public.ft2 Output: c1, c2 Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE (((c2 = 6) AND ("C 1" < 100))) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (10 rows) -- This should not be pushed either. @@ -4190,7 +4190,7 @@ select * from ft2 order by c1 using operator(public.<^); -> Foreign Scan on public.ft2 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (7 rows) -- Update local stats on ft2 @@ -4236,7 +4236,7 @@ select * from ft2 order by c1 using operator(public.<^); -> Foreign Scan on public.ft2 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (7 rows) -- Remove from extension @@ -4274,8 +4274,8 @@ drop operator public.<^(int, int); -- the aggregate cannot be pushed down to foreign server. explain (verbose, costs off) select count(t1.c3) from ft2 t1 left join ft2 t2 on (t1.c1 = random() * t2.c2); - QUERY PLAN ---------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------- Aggregate Output: count(t1.c3) -> Hash Left Join @@ -4289,7 +4289,7 @@ select count(t1.c3) from ft2 t1 left join ft2 t2 on (t1.c1 = random() * t2.c2); -> Foreign Scan on public.ft2 t2 Output: t2.c2 Remote SQL: SELECT c2 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (14 rows) -- Subquery in FROM clause having aggregate @@ -4317,7 +4317,7 @@ select count(*), x.b from ft1, (select c2 a, sum(c1) b from ft1 group by c2) x w -> Foreign Scan on public.ft1 ft1_1 Output: ft1_1.c1, ft1_1.c2 Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (21 rows) select count(*), x.b from ft1, (select c2 a, sum(c1) b from ft1 group by c2) x where ft1.c2 = x.a group by x.b order by 1, 2; @@ -4338,8 +4338,8 @@ select count(*), x.b from ft1, (select c2 a, sum(c1) b from ft1 group by c2) x w -- FULL join with IS NULL check in HAVING explain (verbose, costs off) select avg(t1.c1), sum(t2.c1) from ft4 t1 full join ft5 t2 on (t1.c1 = t2.c1) group by t2.c1 having (avg(t1.c1) is null and sum(t2.c1) < 10) or sum(t2.c1) is null order by 1 nulls last, 2; - QUERY PLAN -------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------- Sort Output: (avg(t1.c1)), (sum(t2.c1)) Sort Key: (avg(t1.c1)), (sum(t2.c1)) @@ -4375,7 +4375,7 @@ select avg(t1.c1), sum(t2.c1) from ft4 t1 full join ft5 t2 on (t1.c1 = t2.c1) gr -- subqueries. explain (verbose, costs off) select count(*), sum(t1.c1), avg(t2.c1) from (select c1 from ft4 where c1 between 50 and 60) t1 full join (select c1 from ft5 where c1 between 50 and 60) t2 on (t1.c1 = t2.c1); - QUERY PLAN + QUERY PLAN ------------------------------------------------------------------------------------------------ Aggregate Output: count(*), sum(ft4.c1), avg(ft5.c1) @@ -4390,8 +4390,8 @@ select count(*), sum(t1.c1), avg(t2.c1) from (select c1 from ft4 where c1 betwee -> Foreign Scan on public.ft5 Output: ft5.c1 Remote SQL: SELECT c1 FROM "S 1"."T 4" WHERE (((c1 >= 50) AND (c1 <= 60))) - Optimizer: Pivotal Optimizer (GPORCA) -(18 rows) + Optimizer: GPORCA +(14 rows) select count(*), sum(t1.c1), avg(t2.c1) from (select c1 from ft4 where c1 between 50 and 60) t1 full join (select c1 from ft5 where c1 between 50 and 60) t2 on (t1.c1 = t2.c1); count | sum | avg @@ -4403,17 +4403,17 @@ select count(*), sum(t1.c1), avg(t2.c1) from (select c1 from ft4 where c1 betwee -- foreign server. explain (verbose, costs off) select sum(c2) * (random() <= 1)::int as sum from ft1 order by 1; - QUERY PLAN -------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------ Sort - Output: ((sum(c2) * int4((random() <= '1'::double precision)))) - Sort Key: ((sum(ft1.c2) * int4((random() <= '1'::double precision)))) + Output: ((sum(c2) * ((random() <= '1'::double precision))::integer)) + Sort Key: ((sum(ft1.c2) * ((random() <= '1'::double precision))::integer)) -> Aggregate - Output: (sum(c2) * int4((random() <= '1'::double precision))) + Output: (sum(c2) * ((random() <= '1'::double precision))::integer) -> Foreign Scan on public.ft1 Output: c2 Remote SQL: SELECT c2 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (9 rows) select sum(c2) * (random() <= 1)::int as sum from ft1 order by 1; @@ -4449,8 +4449,8 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Output: (sum((t2.c1 + t1."C 1"))), t2.c1 Relations: Aggregate on (public.ft2 t2) Remote SQL: SELECT sum(("C 1" + $1::integer)), "C 1" FROM "S 1"."T 1" GROUP BY 2 - Optimizer: Postgres query optimizer Settings: enable_hashagg = 'off' + Optimizer: Postgres query optimizer (21 rows) select c2, sum from "S 1"."T 1" t1, lateral (select sum(t2.c1 + t1."C 1") sum from ft2 t2 group by t2.c1) qry where t1.c2 * 2 = qry.sum and t1.c2 < 3 and t1."C 1" < 100 order by 1; @@ -4532,7 +4532,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support -- Check with placeHolderVars explain (verbose, costs off) select sum(q.a), count(q.b) from ft4 left join (select 13, avg(ft1.c1), sum(ft2.c1) from ft1 right join ft2 on (ft1.c1 = ft2.c1)) q(a, b, c) on (ft4.c1 <= q.b); - QUERY PLAN + QUERY PLAN --------------------------------------------------------------------------------- Aggregate Output: sum((13)), count((avg(ft1.c1))) @@ -4557,7 +4557,7 @@ select sum(q.a), count(q.b) from ft4 left join (select 13, avg(ft1.c1), sum(ft2. -> Foreign Scan on public.ft1 Output: ft1.c1 Remote SQL: SELECT "C 1" FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (24 rows) select sum(q.a), count(q.b) from ft4 left join (select 13, avg(ft1.c1), sum(ft2.c1) from ft1 right join ft2 on (ft1.c1 = ft2.c1)) q(a, b, c) on (ft4.c1 <= q.b); @@ -4592,7 +4592,7 @@ select c2, sum(c1) from ft1 where c2 < 3 group by rollup(c2) order by 1 nulls la Output: NULL::integer, sum(share0_ref3.c1) -> Shared Scan (share slice:id 0:0) Output: share0_ref3.c2, share0_ref3.c1 - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (21 rows) select c2, sum(c1) from ft1 where c2 < 3 group by rollup(c2) order by 1 nulls last; @@ -4628,7 +4628,7 @@ select c2, sum(c1) from ft1 where c2 < 3 group by cube(c2) order by 1 nulls last Output: NULL::integer, sum(share0_ref3.c1) -> Shared Scan (share slice:id 0:0) Output: share0_ref3.c2, share0_ref3.c1 - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (21 rows) select c2, sum(c1) from ft1 where c2 < 3 group by cube(c2) order by 1 nulls last; @@ -4665,7 +4665,7 @@ select c2, c6, sum(c1) from ft1 where c2 < 3 group by grouping sets(c2, c6) orde Group Key: share0_ref3.c2 -> Shared Scan (share slice:id 0:0) Output: share0_ref3.c2, share0_ref3.c6, share0_ref3.c1 - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (22 rows) select c2, c6, sum(c1) from ft1 where c2 < 3 group by grouping sets(c2, c6) order by 1 nulls last, 2 nulls last; @@ -4694,7 +4694,7 @@ select c2, sum(c1), grouping(c2) from ft1 where c2 < 3 group by c2 order by 1 nu -> Foreign Scan on public.ft1 Output: c1, c2 Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE ((c2 < 3)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (12 rows) select c2, sum(c1), grouping(c2) from ft1 where c2 < 3 group by c2 order by 1 nulls last; @@ -4722,7 +4722,7 @@ select distinct sum(c1)/1000 s from ft2 where c2 < 6 group by c2 order by 1; -> Foreign Scan on public.ft2 Output: c1, c2 Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE ((c2 < 6)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (13 rows) select distinct sum(c1)/1000 s from ft2 where c2 < 6 group by c2 order by 1; @@ -4754,7 +4754,7 @@ select c2, sum(c2), count(c2) over (partition by c2%2) from ft2 where c2 < 10 gr -> Foreign Scan on public.ft2 Output: c2 Remote SQL: SELECT c2 FROM "S 1"."T 1" WHERE ((c2 < 10)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (18 rows) select c2, sum(c2), count(c2) over (partition by c2%2) from ft2 where c2 < 10 group by c2 order by 1; @@ -4794,7 +4794,7 @@ select c2, array_agg(c2) over (partition by c2%2 order by c2 desc) from ft1 wher -> Foreign Scan on public.ft1 Output: c2 Remote SQL: SELECT c2 FROM "S 1"."T 1" WHERE ((c2 < 10)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (19 rows) select c2, array_agg(c2) over (partition by c2%2 order by c2 desc) from ft1 where c2 < 10 group by c2 order by 1; @@ -4834,7 +4834,7 @@ select c2, array_agg(c2) over (partition by c2%2 order by c2 range between curre -> Foreign Scan on public.ft1 Output: c2 Remote SQL: SELECT c2 FROM "S 1"."T 1" WHERE ((c2 < 10)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (19 rows) select c2, array_agg(c2) over (partition by c2%2 order by c2 range between current row and unbounded following) from ft1 where c2 < 10 group by c2 order by 1; @@ -4858,8 +4858,8 @@ select c2, array_agg(c2) over (partition by c2%2 order by c2 range between curre -- simple join PREPARE st1(int, int) AS SELECT t1.c3, t2.c3 FROM ft1 t1, ft2 t2 WHERE t1.c1 = $1 AND t2.c1 = $2; EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st1(1, 2); - QUERY PLAN --------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------- Nested Loop Output: t1.c3, t2.c3 Join Filter: true @@ -4871,7 +4871,7 @@ EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st1(1, 2); -> Foreign Scan on public.ft2 t2 Output: t2.c3 Remote SQL: SELECT c3 FROM "S 1"."T 1" WHERE (("C 1" = 2)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (12 rows) EXECUTE st1(1, 1); @@ -4906,7 +4906,7 @@ EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st2(10, 20); Output: t2.c3 Filter: ((t2.c1 > 10) AND (date(t2.c4) = '01-17-1970'::date)) Remote SQL: SELECT "C 1", c3, c4 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (16 rows) EXECUTE st2(10, 20); @@ -4940,7 +4940,7 @@ EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st3(10, 20); -> Foreign Scan on public.ft2 t2 Output: t2.c3 Remote SQL: SELECT c3 FROM "S 1"."T 1" WHERE ((("C 1" > 10) AND (date(c5) = '1970-01-17'::date))) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (15 rows) EXECUTE st3(10, 20); @@ -4962,7 +4962,7 @@ EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st4(1); Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (("C 1" = 1)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st4(1); @@ -4971,7 +4971,7 @@ EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st4(1); Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (("C 1" = 1)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st4(1); @@ -4980,7 +4980,7 @@ EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st4(1); Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (("C 1" = 1)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st4(1); @@ -4989,7 +4989,7 @@ EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st4(1); Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (("C 1" = 1)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st4(1); @@ -4998,17 +4998,17 @@ EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st4(1); Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (("C 1" = 1)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) -- once we try it enough times, should switch to generic plan EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st4(1); - QUERY PLAN ---------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------- Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (("C 1" = $1::integer)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) -- value of $1 should not be sent to remote @@ -5020,7 +5020,7 @@ EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st5('foo', 1); Output: c1, c2, c3, c4, c5, c6, c7, c8 Filter: ((t1.c8 = 'foo'::user_enum) AND (t1.c1 = 1)) Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (5 rows) EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st5('foo', 1); @@ -5030,7 +5030,7 @@ EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st5('foo', 1); Output: c1, c2, c3, c4, c5, c6, c7, c8 Filter: ((t1.c8 = 'foo'::user_enum) AND (t1.c1 = 1)) Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (5 rows) EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st5('foo', 1); @@ -5040,7 +5040,7 @@ EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st5('foo', 1); Output: c1, c2, c3, c4, c5, c6, c7, c8 Filter: ((t1.c8 = 'foo'::user_enum) AND (t1.c1 = 1)) Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (5 rows) EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st5('foo', 1); @@ -5050,7 +5050,7 @@ EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st5('foo', 1); Output: c1, c2, c3, c4, c5, c6, c7, c8 Filter: ((t1.c8 = 'foo'::user_enum) AND (t1.c1 = 1)) Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (5 rows) EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st5('foo', 1); @@ -5060,7 +5060,7 @@ EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st5('foo', 1); Output: c1, c2, c3, c4, c5, c6, c7, c8 Filter: ((t1.c8 = 'foo'::user_enum) AND (t1.c1 = 1)) Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (5 rows) EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st5('foo', 1); @@ -5070,7 +5070,7 @@ EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st5('foo', 1); Output: c1, c2, c3, c4, c5, c6, c7, c8 Filter: ((t1.c8 = $1) AND (t1.c1 = $2)) Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (5 rows) EXECUTE st5('foo', 1); @@ -5087,7 +5087,7 @@ EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st6; Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (("C 1" = c2)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) PREPARE st7 AS INSERT INTO ft1 (c1,c2,c3) VALUES (1001,101,'foo'); @@ -5098,10 +5098,11 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Insert on public.ft1 Remote SQL: INSERT INTO "S 1"."T 1"("C 1", c2, c3, c4, c5, c6, c7, c8) VALUES ($1, $2, $3, $4, $5, $6, $7, $8) + Batch Size: 1 -> Result Output: NULL::integer, 1001, 101, 'foo'::text, NULL::timestamp with time zone, NULL::timestamp without time zone, NULL::character varying, 'ft1 '::character(10), NULL::user_enum Optimizer: Postgres query optimizer -(5 rows) +(6 rows) \! env PGOPTIONS='' psql -p ${PG_PORT} contrib_regression -c 'ALTER TABLE "S 1"."T 1" RENAME TO "T 0"'; ALTER TABLE @@ -5112,7 +5113,7 @@ EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st6; Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 0" WHERE (("C 1" = c2)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) EXECUTE st6; @@ -5136,29 +5137,30 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Insert on public.ft1 Remote SQL: INSERT INTO "S 1"."T 0"("C 1", c2, c3, c4, c5, c6, c7, c8) VALUES ($1, $2, $3, $4, $5, $6, $7, $8) + Batch Size: 1 -> Result Output: NULL::integer, 1001, 101, 'foo'::text, NULL::timestamp with time zone, NULL::timestamp without time zone, NULL::character varying, 'ft1 '::character(10), NULL::user_enum Optimizer: Postgres query optimizer -(5 rows) +(6 rows) \! env PGOPTIONS='' psql -p ${PG_PORT} contrib_regression -c 'ALTER TABLE "S 1"."T 0" RENAME TO "T 1"'; ALTER TABLE ALTER FOREIGN TABLE ft1 OPTIONS (SET table_name 'T 1'); PREPARE st8 AS SELECT count(c3) FROM ft1 t1 WHERE t1.c1 === t1.c2; EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st8; - QUERY PLAN + QUERY PLAN ---------------------------------------------------------------------------------------- Aggregate Output: count(c3) -> Foreign Scan on public.ft1 t1 Output: c3 Remote SQL: SELECT c3 FROM "S 1"."T 1" WHERE (("C 1" OPERATOR(public.===) c2)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (6 rows) ALTER SERVER pgserver OPTIONS (DROP extensions); EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st8; - QUERY PLAN + QUERY PLAN ----------------------------------------------------------- Aggregate Output: count(c3) @@ -5166,7 +5168,7 @@ EXPLAIN (VERBOSE, COSTS OFF) EXECUTE st8; Output: c3 Filter: (t1.c1 === t1.c2) Remote SQL: SELECT "C 1", c2, c3 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (7 rows) EXECUTE st8; @@ -5196,7 +5198,7 @@ SELECT * FROM ft1 t1 WHERE t1.tableoid = 'pg_class'::regclass LIMIT 1; Output: c1, c2, c3, c4, c5, c6, c7, c8 Filter: (t1.tableoid = '1259'::oid) Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (7 rows) SELECT * FROM ft1 t1 WHERE t1.tableoid = 'ft1'::regclass LIMIT 1; @@ -5214,7 +5216,7 @@ SELECT tableoid::regclass, * FROM ft1 t1 LIMIT 1; -> Foreign Scan on public.ft1 t1 Output: tableoid, c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (6 rows) SELECT tableoid::regclass, * FROM ft1 t1 LIMIT 1; @@ -5230,7 +5232,7 @@ SELECT * FROM ft1 t1 WHERE t1.ctid = '(0,2)'; Foreign Scan on public.ft1 t1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE ((ctid = '(0,2)'::tid)) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (4 rows) SELECT * FROM ft1 t1 WHERE t1.ctid = '(0,2)'; @@ -5248,7 +5250,7 @@ SELECT ctid, * FROM ft1 t1 LIMIT 1; -> Foreign Scan on public.ft1 t1 Output: ctid, c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8, ctid FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (6 rows) SELECT ctid, * FROM ft1 t1 LIMIT 1; @@ -5285,14 +5287,14 @@ DROP FUNCTION f_test(int); CREATE FOREIGN TABLE reindex_foreign (c1 int, c2 int) SERVER pgserver2 OPTIONS (table_name 'reindex_local'); REINDEX TABLE reindex_foreign; -- error -ERROR: "reindex_foreign" is not a table or materialized view +ERROR: "reindex_foreign" is not a table, directory table or materialized view -- In greenplum, REINDEX CONCURRENTLY is not supported. REINDEX TABLE CONCURRENTLY reindex_foreign; -- error -ERROR: REINDEX CONCURRENTLY is not supported +ERROR: "reindex_foreign" is not a table, directory table or materialized view DROP FOREIGN TABLE reindex_foreign; -- partitions and foreign tables CREATE TABLE reind_fdw_parent (c1 int) PARTITION BY RANGE (c1); -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'c1' as the Greenplum Database data distribution key for this table. +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'c1' as the Apache Cloudberry data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. CREATE TABLE reind_fdw_0_10 PARTITION OF reind_fdw_parent FOR VALUES FROM (0) TO (10); @@ -5303,7 +5305,6 @@ CREATE FOREIGN TABLE reind_fdw_10_20 PARTITION OF reind_fdw_parent REINDEX TABLE reind_fdw_parent; -- ok -- In greenplum, REINDEX CONCURRENTLY is not supported. REINDEX TABLE CONCURRENTLY reind_fdw_parent; -- ok -ERROR: REINDEX CONCURRENTLY is not supported DROP TABLE reind_fdw_parent; -- =================================================================== -- conversion error @@ -5538,13 +5539,14 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Insert on public.ft2 Remote SQL: INSERT INTO "S 1"."T 1"("C 1", c2, c3, c4, c5, c6, c7, c8) VALUES ($1, $2, $3, $4, $5, $6, $7, $8) + Batch Size: 1 -> Subquery Scan on "*SELECT*" Output: "*SELECT*"."?column?", "*SELECT*"."?column?_1", NULL::integer, "*SELECT*"."?column?_2", NULL::timestamp with time zone, NULL::timestamp without time zone, NULL::character varying, 'ft2 '::character(10), NULL::user_enum -> Foreign Scan on public.ft2 ft2_1 Output: (ft2_1.c1 + 1000), (ft2_1.c2 + 100), (ft2_1.c3 || ft2_1.c3) Remote SQL: SELECT "C 1", c2, c3 FROM "S 1"."T 1" LIMIT 20::bigint Optimizer: Postgres query optimizer -(8 rows) +(9 rows) INSERT INTO ft2 (c1,c2,c3) SELECT c1+1000,c2+100, c3 || c3 FROM ft2 LIMIT 20; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -6688,10 +6690,11 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Insert on public.ft2 Output: (ft2.tableoid)::regclass Remote SQL: INSERT INTO "S 1"."T 1"("C 1", c2, c3, c4, c5, c6, c7, c8) VALUES ($1, $2, $3, $4, $5, $6, $7, $8) + Batch Size: 1 -> Result Output: 1200, 999, NULL::integer, 'foo'::text, NULL::timestamp with time zone, NULL::timestamp without time zone, NULL::character varying, 'ft2 '::character(10), NULL::user_enum Optimizer: Postgres query optimizer -(6 rows) +(7 rows) INSERT INTO ft2 (c1,c2,c3) VALUES (1200,999,'foo') RETURNING tableoid::regclass; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -6839,13 +6842,13 @@ UPDATE ft2 AS target SET (c2, c7) = ( ) WHERE c1 > 1100; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-Scalar Subquery - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------- Update on public.ft2 target Remote SQL: UPDATE "S 1"."T 1" SET c2 = $2, c7 = $3 WHERE ctid = $1 -> Foreign Scan on public.ft2 target - Output: target.c1, $1, NULL::integer, target.c3, target.c4, target.c5, target.c6, $2, target.c8, (SubPlan 1 (returns $1,$2)), target.ctid - Remote SQL: SELECT "C 1", c3, c4, c5, c6, c8, ctid FROM "S 1"."T 1" WHERE (("C 1" > 1100)) FOR UPDATE + Output: $1, $2, (SubPlan 1 (returns $1,$2)), target.ctid, target.* + Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8, ctid FROM "S 1"."T 1" WHERE (("C 1" > 1100)) FOR UPDATE SubPlan 1 (returns $1,$2) -> Foreign Scan on public.ft2 src Output: (src.c2 * 10), src.c7 @@ -6884,9 +6887,9 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: UPDATE "S 1"."T 1" SET c3 = $2 WHERE ctid = $1 RETURNING "C 1", c2, c3, c4, c5, c6, c7, c8 -> Foreign Scan on public.ft2 - Output: c1, c2, NULL::integer, 'bar'::text, c4, c5, c6, c7, c8, ctid + Output: 'bar'::text, ctid, ft2.* Filter: (postgres_fdw_abs(ft2.c1) > 2000) - Remote SQL: SELECT "C 1", c2, c4, c5, c6, c7, c8, ctid FROM "S 1"."T 1" FOR UPDATE + Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8, ctid FROM "S 1"."T 1" FOR UPDATE Optimizer: Postgres query optimizer (8 rows) @@ -6914,24 +6917,24 @@ UPDATE ft2 SET c3 = 'baz' RETURNING ft2.*, ft4.*, ft5.*; -- can't be pushed down INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: RETURNING clause - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Update on public.ft2 Output: ft2.c1, ft2.c2, ft2.c3, ft2.c4, ft2.c5, ft2.c6, ft2.c7, ft2.c8, ft4.c1, ft4.c2, ft4.c3, ft5.c1, ft5.c2, ft5.c3 Remote SQL: UPDATE "S 1"."T 1" SET c3 = $2 WHERE ctid = $1 RETURNING "C 1", c2, c3, c4, c5, c6, c7, c8 -> Hash Join - Output: ft2.c1, ft2.c2, NULL::integer, 'baz'::text, ft2.c4, ft2.c5, ft2.c6, ft2.c7, ft2.c8, ft2.ctid, ft4.*, ft5.*, ft4.c1, ft4.c2, ft4.c3, ft5.c1, ft5.c2, ft5.c3 + Output: 'baz'::text, ft2.ctid, ft2.*, ft4.*, ft5.*, ft4.c1, ft4.c2, ft4.c3, ft5.c1, ft5.c2, ft5.c3 Hash Cond: (ft4.c1 = ft5.c1) -> Foreign Scan - Output: ft2.c1, ft2.c2, ft2.c4, ft2.c5, ft2.c6, ft2.c7, ft2.c8, ft2.ctid, ft4.*, ft4.c1, ft4.c2, ft4.c3 + Output: ft2.ctid, ft2.*, ft4.*, ft4.c1, ft4.c2, ft4.c3 Filter: (ft2.c2 === ft4.c1) Relations: (public.ft2) INNER JOIN (public.ft4) - Remote SQL: SELECT r1."C 1", r1.c2, r1.c4, r1.c5, r1.c6, r1.c7, r1.c8, r1.ctid, CASE WHEN (r2.*)::text IS NOT NULL THEN ROW(r2.c1, r2.c2, r2.c3) END, r2.c1, r2.c2, r2.c3 FROM ("S 1"."T 1" r1 INNER JOIN "S 1"."T 3" r2 ON (((r1."C 1" > 2000)))) FOR UPDATE OF r1 + Remote SQL: SELECT r1.ctid, CASE WHEN (r1.*)::text IS NOT NULL THEN ROW(r1."C 1", r1.c2, r1.c3, r1.c4, r1.c5, r1.c6, r1.c7, r1.c8) END, CASE WHEN (r2.*)::text IS NOT NULL THEN ROW(r2.c1, r2.c2, r2.c3) END, r2.c1, r2.c2, r2.c3, r1.c2 FROM ("S 1"."T 1" r1 INNER JOIN "S 1"."T 3" r2 ON (((r1."C 1" > 2000)))) FOR UPDATE OF r1 -> Nested Loop - Output: ft2.c1, ft2.c2, ft2.c4, ft2.c5, ft2.c6, ft2.c7, ft2.c8, ft2.ctid, ft4.*, ft4.c1, ft4.c2, ft4.c3 + Output: ft2.ctid, ft2.*, ft4.*, ft4.c1, ft4.c2, ft4.c3, ft2.c2 -> Foreign Scan on public.ft2 - Output: ft2.c1, ft2.c2, ft2.c4, ft2.c5, ft2.c6, ft2.c7, ft2.c8, ft2.ctid - Remote SQL: SELECT "C 1", c2, c4, c5, c6, c7, c8, ctid FROM "S 1"."T 1" WHERE (("C 1" > 2000)) FOR UPDATE + Output: ft2.ctid, ft2.*, ft2.c2 + Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8, ctid FROM "S 1"."T 1" WHERE (("C 1" > 2000)) FOR UPDATE -> Materialize Output: ft4.*, ft4.c1, ft4.c2, ft4.c3 -> Foreign Scan on public.ft4 @@ -7457,7 +7460,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 ORDER BY c6 DESC NULLS LAST, c1 O -> Foreign Scan on public.ft1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (9 rows) SELECT * FROM ft1 ORDER BY c6 DESC NULLS LAST, c1 OFFSET 795 LIMIT 10; @@ -7487,7 +7490,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 ORDER BY c6 DESC NULLS FIRST, c1 -> Foreign Scan on public.ft1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (9 rows) SELECT * FROM ft1 ORDER BY c6 DESC NULLS FIRST, c1 OFFSET 15 LIMIT 10; @@ -7517,7 +7520,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 ORDER BY c6 ASC NULLS FIRST, c1 O -> Foreign Scan on public.ft1 Output: c1, c2, c3, c4, c5, c6, c7, c8 Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (9 rows) SELECT * FROM ft1 ORDER BY c6 ASC NULLS FIRST, c1 OFFSET 15 LIMIT 10; @@ -7542,15 +7545,15 @@ SELECT * FROM ft1 ORDER BY c6 ASC NULLS FIRST, c1 OFFSET 15 LIMIT 10; SET constraint_exclusion = 'off'; ALTER FOREIGN TABLE ft1 ADD CONSTRAINT ft1_c2positive CHECK (c2 >= 0); EXPLAIN (VERBOSE, COSTS OFF) SELECT count(*) FROM ft1 WHERE c2 < 0; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Aggregate Output: count(*) -> Result - Output: NULL::integer, NULL::tid, NULL::xid, NULL::cid, NULL::xid, NULL::cid, NULL::oid, NULL::integer + Output: NULL::integer, NULL::tid, NULL::xid, NULL::cid, NULL::xid, NULL::cid, NULL::oid, NULL::integer, NULL::oid One-Time Filter: false - Optimizer: Pivotal Optimizer (GPORCA) Settings: constraint_exclusion = 'off' + Optimizer: GPORCA (7 rows) SELECT count(*) FROM ft1 WHERE c2 < 0; @@ -7561,15 +7564,16 @@ SELECT count(*) FROM ft1 WHERE c2 < 0; SET constraint_exclusion = 'on'; EXPLAIN (VERBOSE, COSTS OFF) SELECT count(*) FROM ft1 WHERE c2 < 0; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Aggregate Output: count(*) -> Result - Output: NULL::integer, NULL::tid, NULL::xid, NULL::cid, NULL::xid, NULL::cid, NULL::oid, NULL::integer + Output: NULL::integer, NULL::tid, NULL::xid, NULL::cid, NULL::xid, NULL::cid, NULL::oid, NULL::integer, NULL::oid One-Time Filter: false - Optimizer: Pivotal Optimizer (GPORCA) -(6 rows) + Settings: constraint_exclusion = 'on' + Optimizer: GPORCA +(7 rows) SELECT count(*) FROM ft1 WHERE c2 < 0; count @@ -7596,15 +7600,15 @@ ALTER FOREIGN TABLE ft1 DROP CONSTRAINT ft1_c2positive; -- But inconsistent check constraints provide inconsistent results ALTER FOREIGN TABLE ft1 ADD CONSTRAINT ft1_c2negative CHECK (c2 < 0); EXPLAIN (VERBOSE, COSTS OFF) SELECT count(*) FROM ft1 WHERE c2 >= 0; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Aggregate Output: count(*) -> Result - Output: NULL::integer, NULL::tid, NULL::xid, NULL::cid, NULL::xid, NULL::cid, NULL::oid, NULL::integer + Output: NULL::integer, NULL::tid, NULL::xid, NULL::cid, NULL::xid, NULL::cid, NULL::oid, NULL::integer, NULL::oid One-Time Filter: false - Optimizer: Pivotal Optimizer (GPORCA) Settings: constraint_exclusion = 'off' + Optimizer: GPORCA (7 rows) SELECT count(*) FROM ft1 WHERE c2 >= 0; @@ -7615,15 +7619,16 @@ SELECT count(*) FROM ft1 WHERE c2 >= 0; SET constraint_exclusion = 'on'; EXPLAIN (VERBOSE, COSTS OFF) SELECT count(*) FROM ft1 WHERE c2 >= 0; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Aggregate Output: count(*) -> Result - Output: NULL::integer, NULL::tid, NULL::xid, NULL::cid, NULL::xid, NULL::cid, NULL::oid, NULL::integer + Output: NULL::integer, NULL::tid, NULL::xid, NULL::cid, NULL::xid, NULL::cid, NULL::oid, NULL::integer, NULL::oid One-Time Filter: false - Optimizer: Pivotal Optimizer (GPORCA) -(6 rows) + Settings: constraint_exclusion = 'on' + Optimizer: GPORCA +(7 rows) SELECT count(*) FROM ft1 WHERE c2 >= 0; count @@ -7664,7 +7669,7 @@ CREATE VIEW rw_view AS SELECT * FROM foreign_tbl INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -7674,7 +7679,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables View "public.rw_view" Column | Type | Collation | Nullable | Default | Storage | Description --------+---------+-----------+----------+---------+---------+------------- @@ -7695,11 +7700,12 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support -------------------------------------------------------------------------------- Insert on public.foreign_tbl Remote SQL: INSERT INTO public.base_tbl(a, b) VALUES ($1, $2) RETURNING a, b + Batch Size: 1 -> Result Output: 0, 5 - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' -(6 rows) + Optimizer: Postgres query optimizer +(7 rows) INSERT INTO rw_view VALUES (0, 5); -- should fail INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -7714,11 +7720,12 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support -------------------------------------------------------------------------------- Insert on public.foreign_tbl Remote SQL: INSERT INTO public.base_tbl(a, b) VALUES ($1, $2) RETURNING a, b + Batch Size: 1 -> Result Output: 0, 15 - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' -(6 rows) + Optimizer: Postgres query optimizer +(7 rows) INSERT INTO rw_view VALUES (0, 15); -- ok INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -7738,10 +7745,10 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Update on public.foreign_tbl Remote SQL: UPDATE public.base_tbl SET b = $2 WHERE ctid = $1 RETURNING a, b -> Foreign Scan on public.foreign_tbl - Output: foreign_tbl.a, (foreign_tbl.b + 5), foreign_tbl.ctid + Output: (foreign_tbl.b + 5), foreign_tbl.ctid, foreign_tbl.* Remote SQL: SELECT a, b, ctid FROM public.base_tbl WHERE ((a < b)) FOR UPDATE - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (7 rows) UPDATE rw_view SET b = b + 5; -- should fail @@ -7758,10 +7765,10 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Update on public.foreign_tbl Remote SQL: UPDATE public.base_tbl SET b = $2 WHERE ctid = $1 RETURNING a, b -> Foreign Scan on public.foreign_tbl - Output: foreign_tbl.a, (foreign_tbl.b + 15), foreign_tbl.ctid + Output: (foreign_tbl.b + 15), foreign_tbl.ctid, foreign_tbl.* Remote SQL: SELECT a, b, ctid FROM public.base_tbl WHERE ((a < b)) FOR UPDATE - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (7 rows) UPDATE rw_view SET b = b + 15; -- ok @@ -7794,7 +7801,7 @@ CREATE TRIGGER CREATE FOREIGN TABLE foreign_tbl (a int, b int) SERVER pgserver OPTIONS (table_name 'child_tbl'); CREATE TABLE parent_tbl (a int, b int) PARTITION BY RANGE(a); -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table. +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Apache Cloudberry data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. ALTER TABLE parent_tbl ATTACH PARTITION foreign_tbl FOR VALUES FROM (0) TO (100); CREATE VIEW rw_view AS SELECT * FROM parent_tbl @@ -7803,7 +7810,7 @@ CREATE VIEW rw_view AS SELECT * FROM parent_tbl INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -7813,7 +7820,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables View "public.rw_view" Column | Type | Collation | Nullable | Default | Storage | Description --------+---------+-----------+----------+---------+---------+------------- @@ -7835,14 +7842,14 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Insert on public.parent_tbl -> Result Output: 0, 5 - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (5 rows) INSERT INTO rw_view VALUES (0, 5); -- should fail INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: View with WITH CHECK OPTION -ERROR: new row violates check option for view "rw_view" (seg1 127.0.0.1:7008 pid=3386) +ERROR: new row violates check option for view "rw_view" (seg1 127.0.0.1:7003 pid=19171) DETAIL: Failing row contains (10, 5). EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view VALUES (0, 15); @@ -7853,8 +7860,8 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Insert on public.parent_tbl -> Result Output: 0, 15 - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (5 rows) INSERT INTO rw_view VALUES (0, 15); -- ok @@ -7870,37 +7877,37 @@ EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view SET b = b + 5; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: View with WITH CHECK OPTION - QUERY PLAN ----------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------ Update on public.parent_tbl - Foreign Update on public.foreign_tbl + Foreign Update on public.foreign_tbl parent_tbl_1 Remote SQL: UPDATE public.child_tbl SET b = $2 WHERE ctid = $1 RETURNING a, b - -> Foreign Scan on public.foreign_tbl - Output: foreign_tbl.a, (foreign_tbl.b + 5), foreign_tbl.ctid + -> Foreign Scan on public.foreign_tbl parent_tbl_1 + Output: (parent_tbl_1.b + 5), parent_tbl_1.tableoid, parent_tbl_1.ctid, parent_tbl_1.* Remote SQL: SELECT a, b, ctid FROM public.child_tbl WHERE ((a < b)) FOR UPDATE - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (8 rows) UPDATE rw_view SET b = b + 5; -- should fail INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: View with WITH CHECK OPTION -ERROR: new row violates check option for view "rw_view" (seg1 127.0.0.1:7008 pid=3386) +ERROR: new row violates check option for view "rw_view" (seg1 127.0.0.1:7003 pid=19171) DETAIL: Failing row contains (20, 20). EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view SET b = b + 15; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: View with WITH CHECK OPTION - QUERY PLAN ----------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------- Update on public.parent_tbl - Foreign Update on public.foreign_tbl + Foreign Update on public.foreign_tbl parent_tbl_1 Remote SQL: UPDATE public.child_tbl SET b = $2 WHERE ctid = $1 RETURNING a, b - -> Foreign Scan on public.foreign_tbl - Output: foreign_tbl.a, (foreign_tbl.b + 15), foreign_tbl.ctid + -> Foreign Scan on public.foreign_tbl parent_tbl_1 + Output: (parent_tbl_1.b + 15), parent_tbl_1.tableoid, parent_tbl_1.ctid, parent_tbl_1.* Remote SQL: SELECT a, b, ctid FROM public.child_tbl WHERE ((a < b)) FOR UPDATE - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (8 rows) -- In greenplum, table parent_tbl and foreign_tbl have different data distribution policy. @@ -7997,11 +8004,12 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support ------------------------------------------------------------------- Insert on public.grem1 Remote SQL: INSERT INTO public.gloc1(a, b) VALUES ($1, DEFAULT) + Batch Size: 1 -> Values Scan on "*VALUES*" Output: "*VALUES*".column1, NULL::integer - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' -(6 rows) + Optimizer: Postgres query optimizer +(7 rows) insert into grem1 (a) values (1), (2); INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -8010,15 +8018,15 @@ explain (verbose, costs off) update grem1 set a = 22 where a = 2; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Updates with foreign tables - QUERY PLAN ---------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------ Update on public.grem1 Remote SQL: UPDATE public.gloc1 SET a = $2, b = DEFAULT WHERE ctid = $1 -> Foreign Scan on public.grem1 - Output: 22, b, ctid - Remote SQL: SELECT b, ctid FROM public.gloc1 WHERE ((a = 2)) FOR UPDATE - Optimizer: Postgres query optimizer + Output: 22, ctid, grem1.* + Remote SQL: SELECT a, b, ctid FROM public.gloc1 WHERE ((a = 2)) FOR UPDATE Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (7 rows) update grem1 set a = 22 where a = 2; @@ -8337,10 +8345,10 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Update on public.rem1 Remote SQL: UPDATE public.loc1 SET f1 = $2, f2 = $3 WHERE ctid = $1 -> Foreign Scan on public.rem1 - Output: 10, f2, ctid, rem1.*, gp_segment_id + Output: 10, ctid, rem1.* Remote SQL: SELECT f1, f2, ctid FROM public.loc1 FOR UPDATE - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (7 rows) UPDATE rem1 set f1 = 10; @@ -8532,8 +8540,8 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Update on public.rem1 -> Foreign Update on public.rem1 Remote SQL: UPDATE public.loc1 SET f2 = ''::text - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (5 rows) EXPLAIN (verbose, costs off) @@ -8545,8 +8553,8 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Delete on public.rem1 -> Foreign Delete on public.rem1 Remote SQL: DELETE FROM public.loc1 - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (5 rows) -- DROP TRIGGER trig_stmt_before ON rem1; @@ -8564,8 +8572,8 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Update on public.rem1 -> Foreign Update on public.rem1 Remote SQL: UPDATE public.loc1 SET f2 = ''::text - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (5 rows) EXPLAIN (verbose, costs off) @@ -8577,8 +8585,8 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Delete on public.rem1 -> Foreign Delete on public.rem1 Remote SQL: DELETE FROM public.loc1 - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (5 rows) -- DROP TRIGGER trig_stmt_after ON rem1; @@ -8595,8 +8603,8 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Update on public.rem1 -> Foreign Update on public.rem1 Remote SQL: UPDATE public.loc1 SET f2 = ''::text - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (5 rows) EXPLAIN (verbose, costs off) @@ -8608,8 +8616,8 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Delete on public.rem1 -> Foreign Delete on public.rem1 Remote SQL: DELETE FROM public.loc1 - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (5 rows) DROP TRIGGER trig_row_before_insert ON rem1; @@ -8625,8 +8633,8 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Update on public.rem1 -> Foreign Update on public.rem1 Remote SQL: UPDATE public.loc1 SET f2 = ''::text - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (5 rows) EXPLAIN (verbose, costs off) @@ -8638,8 +8646,8 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Delete on public.rem1 -> Foreign Delete on public.rem1 Remote SQL: DELETE FROM public.loc1 - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (5 rows) DROP TRIGGER trig_row_after_insert ON rem1; @@ -8656,10 +8664,10 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Update on public.rem1 Remote SQL: UPDATE public.loc1 SET f1 = $2, f2 = $3 WHERE ctid = $1 -> Foreign Scan on public.rem1 - Output: f1, ''::text, ctid, rem1.*, gp_segment_id + Output: ''::text, ctid, rem1.* Remote SQL: SELECT f1, f2, ctid FROM public.loc1 FOR UPDATE - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (7 rows) EXPLAIN (verbose, costs off) @@ -8671,8 +8679,8 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Delete on public.rem1 -> Foreign Delete on public.rem1 Remote SQL: DELETE FROM public.loc1 - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (5 rows) DROP TRIGGER trig_row_before_update ON rem1; @@ -8688,10 +8696,10 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Update on public.rem1 Remote SQL: UPDATE public.loc1 SET f2 = $2 WHERE ctid = $1 RETURNING f1, f2 -> Foreign Scan on public.rem1 - Output: f1, ''::text, ctid, rem1.*, gp_segment_id + Output: ''::text, ctid, rem1.* Remote SQL: SELECT f1, f2, ctid FROM public.loc1 FOR UPDATE - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (7 rows) EXPLAIN (verbose, costs off) @@ -8703,8 +8711,8 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Delete on public.rem1 -> Foreign Delete on public.rem1 Remote SQL: DELETE FROM public.loc1 - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (5 rows) DROP TRIGGER trig_row_after_update ON rem1; @@ -8721,8 +8729,8 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Update on public.rem1 -> Foreign Update on public.rem1 Remote SQL: UPDATE public.loc1 SET f2 = ''::text - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (5 rows) EXPLAIN (verbose, costs off) @@ -8734,10 +8742,10 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Delete on public.rem1 Remote SQL: DELETE FROM public.loc1 WHERE ctid = $1 -> Foreign Scan on public.rem1 - Output: ctid, rem1.*, gp_segment_id + Output: ctid, rem1.* Remote SQL: SELECT f1, f2, ctid FROM public.loc1 FOR UPDATE - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (7 rows) DROP TRIGGER trig_row_before_delete ON rem1; @@ -8753,8 +8761,8 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Update on public.rem1 -> Foreign Update on public.rem1 Remote SQL: UPDATE public.loc1 SET f2 = ''::text - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (5 rows) EXPLAIN (verbose, costs off) @@ -8766,10 +8774,10 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Delete on public.rem1 Remote SQL: DELETE FROM public.loc1 WHERE ctid = $1 RETURNING f1, f2 -> Foreign Scan on public.rem1 - Output: ctid, rem1.*, gp_segment_id + Output: ctid, rem1.* Remote SQL: SELECT f1, f2, ctid FROM public.loc1 FOR UPDATE - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (7 rows) DROP TRIGGER trig_row_after_delete ON rem1; @@ -8777,10 +8785,10 @@ DROP TRIGGER trig_row_after_delete ON rem1; -- test inheritance features -- =================================================================== CREATE TABLE a (aa TEXT); -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'aa' as the Greenplum Database data distribution key for this table. +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'aa' as the Apache Cloudberry data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. ALTER TABLE a SET (autovacuum_enabled = 'false'); -WARNING: autovacuum is not supported in Greenplum +WARNING: autovacuum is not supported in Cloudberry \! env PGOPTIONS='' psql -p ${PG_PORT} contrib_regression -c 'CREATE TABLE loct (aa TEXT, bb TEXT);' CREATE TABLE \! env PGOPTIONS='' psql -p ${PG_PORT} contrib_regression -c 'ALTER TABLE loct SET (autovacuum_enabled = 'false');' @@ -8854,9 +8862,9 @@ INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Inherited tables tableoid | aa ----------+------- - a | aaa a | aaaa a | aaaaa + a | aaa b | new b | new b | new @@ -8906,33 +8914,33 @@ CREATE TABLE \! env PGOPTIONS='' psql -p ${PG_PORT} contrib_regression -c 'create table loct2 (f1 int, f2 int, f3 int);' CREATE TABLE create table loct1 (f1 int, f2 int, f3 int); -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'f1' as the Greenplum Database data distribution key for this table. +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'f1' as the Apache Cloudberry data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. create table loct2 (f1 int, f2 int, f3 int); -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'f1' as the Greenplum Database data distribution key for this table. +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'f1' as the Apache Cloudberry data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. \! env PGOPTIONS='' psql -p ${PG_PORT} contrib_regression -c 'alter table loct1 set (autovacuum_enabled = 'false');' ALTER TABLE \! env PGOPTIONS='' psql -p ${PG_PORT} contrib_regression -c 'alter table loct2 set (autovacuum_enabled = 'false');' ALTER TABLE alter table loct1 set (autovacuum_enabled = 'false'); -WARNING: autovacuum is not supported in Greenplum +WARNING: autovacuum is not supported in Cloudberry alter table loct2 set (autovacuum_enabled = 'false'); -WARNING: autovacuum is not supported in Greenplum +WARNING: autovacuum is not supported in Cloudberry create table foo (f1 int, f2 int); -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'f1' as the Greenplum Database data distribution key for this table. +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'f1' as the Apache Cloudberry data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. create foreign table foo2 (f3 int) inherits (foo) server pgserver options (table_name 'loct1'); create table bar (f1 int, f2 int); -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'f1' as the Greenplum Database data distribution key for this table. +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'f1' as the Apache Cloudberry data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. create foreign table bar2 (f3 int) inherits (bar) server pgserver options (table_name 'loct2'); alter table foo set (autovacuum_enabled = 'false'); -WARNING: autovacuum is not supported in Greenplum +WARNING: autovacuum is not supported in Cloudberry alter table bar set (autovacuum_enabled = 'false'); -WARNING: autovacuum is not supported in Greenplum +WARNING: autovacuum is not supported in Cloudberry insert into foo values(1,1); INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Inherited tables @@ -8975,11 +8983,11 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Hash Cond: (bar.f1 = foo.f1) -> Append -> Gather Motion 3:1 (slice1; segments: 3) - Output: bar.f1, bar.f2, bar.ctid, bar.*, bar.tableoid - -> Seq Scan on public.bar - Output: bar.f1, bar.f2, bar.ctid, bar.*, bar.tableoid - -> Foreign Scan on public.bar2 - Output: bar2.f1, bar2.f2, bar2.ctid, bar2.*, bar2.tableoid + Output: bar_1.f1, bar_1.f2, bar_1.ctid, bar_1.*, bar_1.tableoid + -> Seq Scan on public.bar bar_1 + Output: bar_1.f1, bar_1.f2, bar_1.ctid, bar_1.*, bar_1.tableoid + -> Foreign Scan on public.bar2 bar_2 + Output: bar_2.f1, bar_2.f2, bar_2.ctid, bar_2.*, bar_2.tableoid Remote SQL: SELECT f1, f2, f3, ctid FROM public.loct2 FOR UPDATE -> Hash Output: foo.ctid, foo.f1, foo.*, foo.tableoid @@ -8988,14 +8996,14 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Group Key: foo.f1 -> Append -> Gather Motion 3:1 (slice2; segments: 3) - Output: foo.ctid, foo.f1, foo.*, foo.tableoid - -> Seq Scan on public.foo - Output: foo.ctid, foo.f1, foo.*, foo.tableoid - -> Foreign Scan on public.foo2 - Output: foo2.ctid, foo2.f1, foo2.*, foo2.tableoid + Output: foo_1.ctid, foo_1.f1, foo_1.*, foo_1.tableoid + -> Seq Scan on public.foo foo_1 + Output: foo_1.ctid, foo_1.f1, foo_1.*, foo_1.tableoid + -> Foreign Scan on public.foo2 foo_2 + Output: foo_2.ctid, foo_2.f1, foo_2.*, foo_2.tableoid Remote SQL: SELECT f1, f2, f3, ctid FROM public.loct1 - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (27 rows) select * from bar where f1 in (select f1 from foo) for update; @@ -9021,11 +9029,11 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Hash Cond: (bar.f1 = foo.f1) -> Append -> Gather Motion 3:1 (slice1; segments: 3) - Output: bar.f1, bar.f2, bar.ctid, bar.*, bar.tableoid - -> Seq Scan on public.bar - Output: bar.f1, bar.f2, bar.ctid, bar.*, bar.tableoid - -> Foreign Scan on public.bar2 - Output: bar2.f1, bar2.f2, bar2.ctid, bar2.*, bar2.tableoid + Output: bar_1.f1, bar_1.f2, bar_1.ctid, bar_1.*, bar_1.tableoid + -> Seq Scan on public.bar bar_1 + Output: bar_1.f1, bar_1.f2, bar_1.ctid, bar_1.*, bar_1.tableoid + -> Foreign Scan on public.bar2 bar_2 + Output: bar_2.f1, bar_2.f2, bar_2.ctid, bar_2.*, bar_2.tableoid Remote SQL: SELECT f1, f2, f3, ctid FROM public.loct2 FOR SHARE -> Hash Output: foo.ctid, foo.f1, foo.*, foo.tableoid @@ -9034,14 +9042,14 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support Group Key: foo.f1 -> Append -> Gather Motion 3:1 (slice2; segments: 3) - Output: foo.ctid, foo.f1, foo.*, foo.tableoid - -> Seq Scan on public.foo - Output: foo.ctid, foo.f1, foo.*, foo.tableoid - -> Foreign Scan on public.foo2 - Output: foo2.ctid, foo2.f1, foo2.*, foo2.tableoid + Output: foo_1.ctid, foo_1.f1, foo_1.*, foo_1.tableoid + -> Seq Scan on public.foo foo_1 + Output: foo_1.ctid, foo_1.f1, foo_1.*, foo_1.tableoid + -> Foreign Scan on public.foo2 foo_2 + Output: foo_2.ctid, foo_2.f1, foo_2.*, foo_2.tableoid Remote SQL: SELECT f1, f2, f3, ctid FROM public.loct1 - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off' + Optimizer: Postgres query optimizer (27 rows) select * from bar where f1 in (select f1 from foo) for share; @@ -9049,8 +9057,8 @@ INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Inherited tables f1 | f2 ----+---- - 2 | 22 1 | 11 + 2 | 22 3 | 33 4 | 44 (4 rows) @@ -9129,8 +9137,8 @@ explain (verbose, costs off) select foo.f1, loct1.f1 from foo join loct1 on (foo.f1 = loct1.f1) order by foo.f2 offset 10 limit 10; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Inherited tables - QUERY PLAN --------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------- Limit Output: foo.f1, loct1.f1, foo.f2 -> Gather Motion 3:1 (slice1; segments: 3) @@ -9144,24 +9152,28 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support -> Merge Join Output: foo.f1, loct1.f1, foo.f2 Merge Cond: (foo.f1 = loct1.f1) - -> Redistribute Motion 1:3 (slice2) + -> Sort Output: foo.f1, foo.f2 - Hash Key: foo.f1 - -> Merge Append - Sort Key: foo.f1 - -> Gather Motion 3:1 (slice3; segments: 3) - Output: foo.f1, foo.f2 - Merge Key: foo.f1 - -> Index Scan using i_foo_f1 on public.foo - Output: foo.f1, foo.f2 - -> Foreign Scan on public.foo2 - Output: foo2.f1, foo2.f2 - Remote SQL: SELECT f1, f2 FROM public.loct1 ORDER BY f1 ASC NULLS LAST - -> Index Only Scan using i_loct1_f1 on public.loct1 + Sort Key: foo.f1 + -> Redistribute Motion 1:3 (slice2) + Output: foo.f1, foo.f2 + Hash Key: foo.f1 + -> Append + -> Gather Motion 3:1 (slice3; segments: 3) + Output: foo_1.f1, foo_1.f2 + -> Seq Scan on public.foo foo_1 + Output: foo_1.f1, foo_1.f2 + -> Foreign Scan on public.foo2 foo_2 + Output: foo_2.f1, foo_2.f2 + Remote SQL: SELECT f1, f2 FROM public.loct1 + -> Sort Output: loct1.f1 + Sort Key: loct1.f1 + -> Seq Scan on public.loct1 + Output: loct1.f1 + Settings: constraint_exclusion = 'off', enable_hashjoin = 'off', enable_mergejoin = 'on', enable_nestloop = 'off' Optimizer: Postgres query optimizer - Settings: constraint_exclusion = 'off', enable_hashjoin = 'off', enable_mergejoin = 'on' -(30 rows) +(34 rows) select foo.f1, loct1.f1 from foo join loct1 on (foo.f1 = loct1.f1) order by foo.f2 offset 10 limit 10; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -9186,8 +9198,8 @@ explain (verbose, costs off) select foo.f1, loct1.f1 from foo left join loct1 on (foo.f1 = loct1.f1) order by foo.f2 offset 10 limit 10; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Inherited tables - QUERY PLAN --------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------- Limit Output: foo.f1, loct1.f1, foo.f2 -> Gather Motion 3:1 (slice1; segments: 3) @@ -9201,24 +9213,28 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support -> Merge Left Join Output: foo.f1, loct1.f1, foo.f2 Merge Cond: (foo.f1 = loct1.f1) - -> Redistribute Motion 1:3 (slice2) + -> Sort Output: foo.f1, foo.f2 - Hash Key: foo.f1 - -> Merge Append - Sort Key: foo.f1 - -> Gather Motion 3:1 (slice3; segments: 3) - Output: foo.f1, foo.f2 - Merge Key: foo.f1 - -> Index Scan using i_foo_f1 on public.foo - Output: foo.f1, foo.f2 - -> Foreign Scan on public.foo2 - Output: foo2.f1, foo2.f2 - Remote SQL: SELECT f1, f2 FROM public.loct1 ORDER BY f1 ASC NULLS LAST - -> Index Only Scan using i_loct1_f1 on public.loct1 + Sort Key: foo.f1 + -> Redistribute Motion 1:3 (slice2) + Output: foo.f1, foo.f2 + Hash Key: foo.f1 + -> Append + -> Gather Motion 3:1 (slice3; segments: 3) + Output: foo_1.f1, foo_1.f2 + -> Seq Scan on public.foo foo_1 + Output: foo_1.f1, foo_1.f2 + -> Foreign Scan on public.foo2 foo_2 + Output: foo_2.f1, foo_2.f2 + Remote SQL: SELECT f1, f2 FROM public.loct1 + -> Sort Output: loct1.f1 + Sort Key: loct1.f1 + -> Seq Scan on public.loct1 + Output: loct1.f1 + Settings: constraint_exclusion = 'off', enable_hashjoin = 'off', enable_mergejoin = 'on', enable_nestloop = 'off' Optimizer: Postgres query optimizer - Settings: constraint_exclusion = 'off', enable_hashjoin = 'off', enable_mergejoin = 'on' -(30 rows) +(34 rows) select foo.f1, loct1.f1 from foo left join loct1 on (foo.f1 = loct1.f1) order by foo.f2 offset 10 limit 10; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -9294,7 +9310,7 @@ drop table loct1; drop table loct2; -- Test pushing down UPDATE/DELETE joins to the remote server create table parent (a int, b text); -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table. +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Apache Cloudberry data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. \! env PGOPTIONS='' psql -p ${PG_PORT} contrib_regression -c 'create table loct1 (a int, b text);' CREATE TABLE @@ -9346,7 +9362,7 @@ drop table parent; -- =================================================================== -- Test insert tuple routing create table itrtest (a int, b text) partition by list (a); -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table. +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Apache Cloudberry data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. \! env PGOPTIONS='' psql -p ${PG_PORT} contrib_regression -c 'create table loct1 (a int check (a in (1)), b text);' CREATE TABLE @@ -9385,8 +9401,8 @@ INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: RETURNING clause a | b ---+------- - 2 | test2 1 | test1 + 2 | test2 (2 rows) select tableoid::regclass, * FROM itrtest; @@ -9638,7 +9654,7 @@ drop table utrtest; */ -- Test copy tuple routing create table ctrtest (a int, b text) partition by list (a); -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table. +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Apache Cloudberry data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. \! env PGOPTIONS='' psql -p ${PG_PORT} contrib_regression -c 'create table loct1 (a int check (a in (1)), b text);' CREATE TABLE @@ -9860,8 +9876,8 @@ NOTICE: NEW: (2,bar) INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation NOTICE: rem2_trig_row_after(23, skidoo) AFTER ROW INSERT ON rem2 -NOTICE: rem2_trig_row_after(23, skidoo) AFTER ROW INSERT ON rem2 NOTICE: NEW: (1,"foo triggered !") +NOTICE: rem2_trig_row_after(23, skidoo) AFTER ROW INSERT ON rem2 NOTICE: NEW: (2,"bar triggered !") select * from rem2; f1 | f2 @@ -9957,7 +9973,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -9965,13 +9981,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest1.t1" @@ -9983,7 +9999,7 @@ Server: pgserver FDW options: (schema_name 'import_source', table_name 't1') INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -9991,13 +10007,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest1.t2" @@ -10010,7 +10026,7 @@ Server: pgserver FDW options: (schema_name 'import_source', table_name 't2') INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10018,13 +10034,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest1.t3" @@ -10036,7 +10052,7 @@ Server: pgserver FDW options: (schema_name 'import_source', table_name 't3') INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10044,13 +10060,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest1.t4" @@ -10061,7 +10077,7 @@ Server: pgserver FDW options: (schema_name 'import_source', table_name 't4') INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10069,13 +10085,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest1.x 4" @@ -10088,7 +10104,7 @@ Server: pgserver FDW options: (schema_name 'import_source', table_name 'x 4') INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10096,13 +10112,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest1.x 5" @@ -10112,7 +10128,7 @@ Server: pgserver FDW options: (schema_name 'import_source', table_name 'x 5') INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10120,13 +10136,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest1.x 6" @@ -10160,7 +10176,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10168,13 +10184,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest2.t1" @@ -10186,7 +10202,7 @@ Server: pgserver FDW options: (schema_name 'import_source', table_name 't1') INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10194,13 +10210,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest2.t2" @@ -10213,7 +10229,7 @@ Server: pgserver FDW options: (schema_name 'import_source', table_name 't2') INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10221,13 +10237,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest2.t3" @@ -10239,7 +10255,7 @@ Server: pgserver FDW options: (schema_name 'import_source', table_name 't3') INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10247,13 +10263,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest2.t4" @@ -10264,7 +10280,7 @@ Server: pgserver FDW options: (schema_name 'import_source', table_name 't4') INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10272,13 +10288,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest2.x 4" @@ -10291,7 +10307,7 @@ Server: pgserver FDW options: (schema_name 'import_source', table_name 'x 4') INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10299,13 +10315,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest2.x 5" @@ -10315,7 +10331,7 @@ Server: pgserver FDW options: (schema_name 'import_source', table_name 'x 5') INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10323,13 +10339,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest2.x 6" @@ -10362,7 +10378,7 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10370,13 +10386,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest3.t1" @@ -10388,7 +10404,7 @@ Server: pgserver FDW options: (schema_name 'import_source', table_name 't1') INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10396,13 +10412,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest3.t2" @@ -10415,7 +10431,7 @@ Server: pgserver FDW options: (schema_name 'import_source', table_name 't2') INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10423,13 +10439,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest3.t3" @@ -10441,7 +10457,7 @@ Server: pgserver FDW options: (schema_name 'import_source', table_name 't3') INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10449,13 +10465,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest3.t4" @@ -10466,7 +10482,7 @@ Server: pgserver FDW options: (schema_name 'import_source', table_name 't4') INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10474,13 +10490,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest3.x 4" @@ -10493,7 +10509,7 @@ Server: pgserver FDW options: (schema_name 'import_source', table_name 'x 4') INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10501,13 +10517,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest3.x 5" @@ -10517,7 +10533,7 @@ Server: pgserver FDW options: (schema_name 'import_source', table_name 'x 5') INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner @@ -10525,13 +10541,13 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner -DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on coordinator-only tables +DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Queries on master-only tables INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: Non-default collation Foreign table "import_dest3.x 6" @@ -10696,7 +10712,7 @@ INSERT 0 125 \! env PGOPTIONS='' psql -p ${PG_PORT} contrib_regression -c 'INSERT INTO fprt1_p2 SELECT i, i, to_char(i/50, $$FM0000$$) FROM generate_series(250, 499, 2) i;' INSERT 0 125 CREATE TABLE fprt1 (a int, b int, c varchar) PARTITION BY RANGE(a); -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table. +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Apache Cloudberry data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. -- CREATE TABLE fprt1_p1 (LIKE fprt1); -- CREATE TABLE fprt1_p2 (LIKE fprt1); @@ -10732,7 +10748,7 @@ INSERT 0 84 \! env PGOPTIONS='' psql -p ${PG_PORT} contrib_regression -c 'INSERT INTO fprt2_p2 SELECT i, i, to_char(i/50, $$FM0000$$) FROM generate_series(250, 499, 3) i;' INSERT 0 84 CREATE TABLE fprt2 (a int, b int, c varchar) PARTITION BY RANGE(b); -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table. +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Apache Cloudberry data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. -- CREATE TABLE fprt2_p1 (LIKE fprt2); -- CREATE TABLE fprt2_p2 (LIKE fprt2); @@ -10759,15 +10775,15 @@ EXPLAIN (COSTS OFF) SELECT t1.a,t2.b,t3.c FROM fprt1 t1 INNER JOIN fprt2 t2 ON (t1.a = t2.b) INNER JOIN fprt1 t3 ON (t2.b = t3.a) WHERE t1.a % 25 =0 ORDER BY 1,2,3; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because no plan has been computed for required properties in GPORCA - QUERY PLAN --------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------- Sort Sort Key: t1.a, t3.c -> Append -> Foreign Scan - Relations: ((public.ftprt1_p1 t1) INNER JOIN (public.ftprt2_p1 t2)) INNER JOIN (public.ftprt1_p1 t3) + Relations: ((ftprt1_p1 t1_1) INNER JOIN (ftprt2_p1 t2_1)) INNER JOIN (ftprt1_p1 t3_1) -> Foreign Scan - Relations: ((public.ftprt1_p2 t1) INNER JOIN (public.ftprt2_p2 t2)) INNER JOIN (public.ftprt1_p2 t3) + Relations: ((ftprt1_p2 t1_2) INNER JOIN (ftprt2_p2 t2_2)) INNER JOIN (ftprt1_p2 t3_2) Optimizer: Postgres query optimizer (8 rows) @@ -10812,8 +10828,8 @@ SELECT t1.a,t2.b,t2.c FROM fprt1 t1 LEFT JOIN (SELECT * FROM fprt2 WHERE a < 10) Output: fprt2.a, fprt2.b, fprt2.c Filter: ((fprt2.a < 10) AND (fprt2.b < 10)) Number of partitions to scan: 1 (out of 2) - Optimizer: Pivotal Optimizer (GPORCA) Settings: constraint_exclusion = 'off', enable_partitionwise_join = 'on' + Optimizer: GPORCA (27 rows) SELECT t1.a,t2.b,t2.c FROM fprt1 t1 LEFT JOIN (SELECT * FROM fprt2 WHERE a < 10) t2 ON (t1.a = t2.b and t1.b = t2.a) WHERE t1.a < 10 ORDER BY 1,2,3; @@ -10838,12 +10854,12 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support -> Hash Full Join Hash Cond: (t1.a = t2.b) -> Append - -> Foreign Scan on ftprt1_p1 t1 - -> Foreign Scan on ftprt1_p2 t1_1 + -> Foreign Scan on ftprt1_p1 t1_1 + -> Foreign Scan on ftprt1_p2 t1_2 -> Hash -> Append - -> Foreign Scan on ftprt2_p1 t2 - -> Foreign Scan on ftprt2_p2 t2_1 + -> Foreign Scan on ftprt2_p1 t2_1 + -> Foreign Scan on ftprt2_p2 t2_2 Optimizer: Postgres query optimizer (12 rows) @@ -10873,15 +10889,15 @@ EXPLAIN (COSTS OFF) SELECT t1.a,t1.b FROM fprt1 t1, LATERAL (SELECT t2.a, t2.b FROM fprt2 t2 WHERE t1.a = t2.b AND t1.b = t2.a) q WHERE t1.a%25 = 0 ORDER BY 1,2; INFO: GPORCA failed to produce a plan, falling back to Postgres-based planner DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: LATERAL - QUERY PLAN ---------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------- Sort Sort Key: t1.a, t1.b -> Append -> Foreign Scan - Relations: (public.ftprt1_p1 t1) INNER JOIN (public.ftprt2_p1 t2) + Relations: (ftprt1_p1 t1_1) INNER JOIN (ftprt2_p1 t2_1) -> Foreign Scan - Relations: (public.ftprt1_p2 t1) INNER JOIN (public.ftprt2_p2 t2) + Relations: (ftprt1_p2 t1_2) INNER JOIN (ftprt2_p2 t2_2) Optimizer: Postgres query optimizer (8 rows) @@ -10899,8 +10915,8 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support -- with PHVs, partitionwise join selected but no join pushdown EXPLAIN (COSTS OFF) SELECT t1.a, t1.phv, t2.b, t2.phv FROM (SELECT 't1_phv' phv, * FROM fprt1 WHERE a % 25 = 0) t1 FULL JOIN (SELECT 't2_phv' phv, * FROM fprt2 WHERE b % 25 = 0) t2 ON (t1.a = t2.b) ORDER BY t1.a, t2.b; - QUERY PLAN ----------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) Merge Key: fprt1.a, fprt2.b -> Sort @@ -10955,13 +10971,13 @@ DETAIL: Falling back to Postgres-based planner because no plan has been compute Hash Cond: (t2.b = t1.a) -> Append Partition Selectors: $0 - -> Foreign Scan on ftprt2_p1 t2 - -> Foreign Scan on ftprt2_p2 t2_1 + -> Foreign Scan on ftprt2_p1 t2_1 + -> Foreign Scan on ftprt2_p2 t2_2 -> Hash -> Partition Selector (selector id: $0) -> Append - -> Foreign Scan on ftprt1_p1 t1 - -> Foreign Scan on ftprt1_p2 t1_1 + -> Foreign Scan on ftprt1_p1 t1_1 + -> Foreign Scan on ftprt1_p2 t1_2 Optimizer: Postgres query optimizer (14 rows) @@ -10982,7 +10998,7 @@ RESET enable_partitionwise_join; -- test partitionwise aggregates -- =================================================================== CREATE TABLE pagg_tab (a int, b int, c text) PARTITION BY RANGE(a); -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table. +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Apache Cloudberry data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. \! env PGOPTIONS='' psql -p ${PG_PORT} contrib_regression -c 'CREATE TABLE pagg_tab (a int, b int, c text) PARTITION BY RANGE(a);' CREATE TABLE @@ -11031,7 +11047,7 @@ SELECT a, sum(b), min(b), count(*) FROM pagg_tab GROUP BY a HAVING avg(b) < 22 O Hash Key: a -> Dynamic Foreign Scan on pagg_tab Number of partitions to scan: 3 (out of 3) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (13 rows) -- Plan with partitionwise aggregates is enabled @@ -11052,7 +11068,7 @@ SELECT a, sum(b), min(b), count(*) FROM pagg_tab GROUP BY a HAVING avg(b) < 22 O Hash Key: a -> Dynamic Foreign Scan on pagg_tab Number of partitions to scan: 3 (out of 3) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (13 rows) SELECT a, sum(b), min(b), count(*) FROM pagg_tab GROUP BY a HAVING avg(b) < 22 ORDER BY 1; @@ -11099,8 +11115,8 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support -> Foreign Scan on public.fpagg_tab_p3 t1_2 Output: t1_2.a, t1_2.*, t1_2.b Remote SQL: SELECT a, b, c FROM public.pagg_tab_p3 - Optimizer: Postgres query optimizer Settings: constraint_exclusion = 'off', enable_partitionwise_aggregate = 'on' + Optimizer: Postgres query optimizer (27 rows) SELECT a, count(t1) FROM pagg_tab t1 GROUP BY a HAVING avg(b) < 22 ORDER BY 1; @@ -11133,7 +11149,7 @@ SELECT b, avg(a), max(a), count(*) FROM pagg_tab GROUP BY b HAVING sum(a) < 700 Hash Key: b -> Dynamic Foreign Scan on pagg_tab Number of partitions to scan: 3 (out of 3) - Optimizer: Pivotal Optimizer (GPORCA) + Optimizer: GPORCA (13 rows) SELECT b, avg(a), max(a), count(*) FROM pagg_tab GROUP BY b HAVING sum(a) < 700 ORDER BY 1; diff --git a/contrib/postgres_fdw/expected/gp_postgres_fdw_optimizer.out b/contrib/postgres_fdw/expected/gp_postgres_fdw_optimizer.out index f381038e5d0..2e16de4b237 100644 --- a/contrib/postgres_fdw/expected/gp_postgres_fdw_optimizer.out +++ b/contrib/postgres_fdw/expected/gp_postgres_fdw_optimizer.out @@ -1,5 +1,5 @@ -- =================================================================== --- Greenplum-specific features for postgres_fdw +-- Cloudberry-specific features for postgres_fdw -- =================================================================== -- =================================================================== -- Create source tables and populate with data @@ -667,9 +667,9 @@ SELECT * FROM postgres_fdw_gp."GP 1" ORDER BY f1; TRUNCATE TABLE postgres_fdw_gp."GP 1"; -- =================================================================== --- validate writes on coordinator (mpp_execute set to coordinator) +-- validate writes on master (mpp_execute set to master) -- =================================================================== -ALTER FOREIGN TABLE gp_ft1 OPTIONS ( SET mpp_execute 'coordinator' ); +ALTER FOREIGN TABLE gp_ft1 OPTIONS ( SET mpp_execute 'master' ); EXPLAIN (COSTS FALSE) INSERT INTO gp_ft1 SELECT * FROM table_dist_rand; QUERY PLAN ------------------------------------------------ @@ -1365,27 +1365,27 @@ ALTER TABLE sub_part_1_prt_1 EXCHANGE PARTITION for(1) WITH TABLE sub_part_1_prt ALTER TABLE sub_part_1_prt_1 EXCHANGE PARTITION for(2) WITH TABLE sub_part_1_prt_1_2_prt_two_foreign; -- explain with ORCA should fall back to planner, rather than raise ERROR explain select * from sub_part; - QUERY PLAN ---------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------- Append (cost=100.00..14631.81 rows=641404 width=12) - -> Foreign Scan on sub_part_1_prt_1_2_prt_one (cost=100.00..383.06 rows=9102 width=12) - -> Foreign Scan on sub_part_1_prt_1_2_prt_two (cost=100.00..383.06 rows=9102 width=12) + -> Foreign Scan on sub_part_1_prt_1_2_prt_one sub_part_1 (cost=100.00..383.06 rows=9102 width=12) + -> Foreign Scan on sub_part_1_prt_1_2_prt_two sub_part_2 (cost=100.00..383.06 rows=9102 width=12) -> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..1332.33 rows=77900 width=12) - -> Seq Scan on sub_part_1_prt_2_2_prt_one (cost=0.00..293.67 rows=25967 width=12) + -> Seq Scan on sub_part_1_prt_2_2_prt_one sub_part_3 (cost=0.00..293.67 rows=25967 width=12) -> Gather Motion 3:1 (slice2; segments: 3) (cost=0.00..1332.33 rows=77900 width=12) - -> Seq Scan on sub_part_1_prt_2_2_prt_two (cost=0.00..293.67 rows=25967 width=12) + -> Seq Scan on sub_part_1_prt_2_2_prt_two sub_part_4 (cost=0.00..293.67 rows=25967 width=12) -> Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..1332.33 rows=77900 width=12) - -> Seq Scan on sub_part_1_prt_3_2_prt_one (cost=0.00..293.67 rows=25967 width=12) + -> Seq Scan on sub_part_1_prt_3_2_prt_one sub_part_5 (cost=0.00..293.67 rows=25967 width=12) -> Gather Motion 3:1 (slice4; segments: 3) (cost=0.00..1332.33 rows=77900 width=12) - -> Seq Scan on sub_part_1_prt_3_2_prt_two (cost=0.00..293.67 rows=25967 width=12) + -> Seq Scan on sub_part_1_prt_3_2_prt_two sub_part_6 (cost=0.00..293.67 rows=25967 width=12) -> Gather Motion 3:1 (slice5; segments: 3) (cost=0.00..1332.33 rows=77900 width=12) - -> Seq Scan on sub_part_1_prt_4_2_prt_one (cost=0.00..293.67 rows=25967 width=12) + -> Seq Scan on sub_part_1_prt_4_2_prt_one sub_part_7 (cost=0.00..293.67 rows=25967 width=12) -> Gather Motion 3:1 (slice6; segments: 3) (cost=0.00..1332.33 rows=77900 width=12) - -> Seq Scan on sub_part_1_prt_4_2_prt_two (cost=0.00..293.67 rows=25967 width=12) + -> Seq Scan on sub_part_1_prt_4_2_prt_two sub_part_8 (cost=0.00..293.67 rows=25967 width=12) -> Gather Motion 3:1 (slice7; segments: 3) (cost=0.00..1332.33 rows=77900 width=12) - -> Seq Scan on sub_part_1_prt_5_2_prt_one (cost=0.00..293.67 rows=25967 width=12) + -> Seq Scan on sub_part_1_prt_5_2_prt_one sub_part_9 (cost=0.00..293.67 rows=25967 width=12) -> Gather Motion 3:1 (slice8; segments: 3) (cost=0.00..1332.33 rows=77900 width=12) - -> Seq Scan on sub_part_1_prt_5_2_prt_two (cost=0.00..293.67 rows=25967 width=12) + -> Seq Scan on sub_part_1_prt_5_2_prt_two sub_part_10 (cost=0.00..293.67 rows=25967 width=12) Optimizer: Postgres query optimizer (20 rows) diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c index fbbd867c239..8f11349af6c 100644 --- a/contrib/postgres_fdw/postgres_fdw.c +++ b/contrib/postgres_fdw/postgres_fdw.c @@ -5881,27 +5881,7 @@ apply_server_options(PgFdwRelationInfo *fpinfo) DefElem *def = (DefElem *) lfirst(lc); if (strcmp(def->defname, "use_remote_estimate") == 0) - { - /* - * GPDB_13_MERGE_FIXME: For updable statement, different forked Backends by Master - * (QD and entrydb instances) - * will hold Exclusive lock on the same table, which causes lock hang issue. - * For Postgres, there is only one backend, and connnections have been shared, - * so the issue doesn't exist. - * - * For example, following query will hang: - * SELECT * - * FROM ft1, ft2, ft4, ft5, local_tbl - * WHERE ft1.c1 = ft2.c1 AND - * ft1.c2 = ft4.c1 AND - * ft1.c2 = ft5.c1 AND - * ft1.c2 = local_tbl.c1 AND - * ft1.c1 < 100 AND - * ft2.c1 < 100 FOR UPDATE; - */ - elog(WARNING, "fdw option 'use_remote_estimate' is not supported."); - fpinfo->use_remote_estimate = false; - } + fpinfo->use_remote_estimate = defGetBoolean(def); else if (strcmp(def->defname, "fdw_startup_cost") == 0) (void) parse_real(defGetString(def), &fpinfo->fdw_startup_cost, 0, NULL); @@ -5933,27 +5913,7 @@ apply_table_options(PgFdwRelationInfo *fpinfo) DefElem *def = (DefElem *) lfirst(lc); if (strcmp(def->defname, "use_remote_estimate") == 0) - { - /* - * GPDB_13_MERGE_FIXME: For updable statement, different forked Backends by Master - * (QD and entrydb instances) - * will hold Exclusive lock on the same table, which causes lock hang issue. - * For Postgres, there is only one backend, and connnections have been shared, - * so the issue doesn't exist. - * - * For example, following query will hang: - * SELECT * - * FROM ft1, ft2, ft4, ft5, local_tbl - * WHERE ft1.c1 = ft2.c1 AND - * ft1.c2 = ft4.c1 AND - * ft1.c2 = ft5.c1 AND - * ft1.c2 = local_tbl.c1 AND - * ft1.c1 < 100 AND - * ft2.c1 < 100 FOR UPDATE; - */ - elog(WARNING, "fdw option 'use_remote_estimate' is not supported."); - fpinfo->use_remote_estimate = false; - } + fpinfo->use_remote_estimate = defGetBoolean(def); else if (strcmp(def->defname, "fetch_size") == 0) (void) parse_int(defGetString(def), &fpinfo->fetch_size, 0, NULL); else if (strcmp(def->defname, "async_capable") == 0) diff --git a/contrib/postgres_fdw/postgres_fdw.h b/contrib/postgres_fdw/postgres_fdw.h index c086e52c8db..4d25dc9d22a 100644 --- a/contrib/postgres_fdw/postgres_fdw.h +++ b/contrib/postgres_fdw/postgres_fdw.h @@ -19,33 +19,7 @@ #include "nodes/pathnodes.h" #include "utils/relcache.h" -/* GPDB_13_MERGE_FIXME: Do we still needs this patch? */ -/* postgres_fdw is compiled as a backend, it needs the server's - * header files such as executor/tuptable.h. It also needs libpq - * to connect to a remote postgres database, so it's statically - * linked to libpq.a which is compiled as a frontend using - * -DFRONTEND. - * - * But the struct PQconninfoOption's length is different between - * backend and frontend, there is no "connofs" field in frontend. - * When postgres_fdw calls the function "PQconndefaults" implemented - * in libpq.a and uses the returned PQconninfoOption variable, it crashs, - * because the PQconninfoOption variable returned by libpq.a doesn't contain - * the "connofs" value, but the postgres_fdw thinks it has, so it crashes. - * - * We define FRONTEND here to include frontend libpq header files. - */ -#ifdef LIBPQ_FE_H -#error "postgres_fdw.h" must be included before "libpq-fe.h" -#endif /* LIBPQ_FE_H */ - -#ifndef FRONTEND -#define FRONTEND -#include "libpq-fe.h" -#undef FRONTEND -#else #include "libpq-fe.h" -#endif /* FRONTEND */ /* * FDW-specific planner information kept in RelOptInfo.fdw_private for a diff --git a/contrib/postgres_fdw/postgres_setup.bash b/contrib/postgres_fdw/postgres_setup.bash new file mode 100755 index 00000000000..4553808e161 --- /dev/null +++ b/contrib/postgres_fdw/postgres_setup.bash @@ -0,0 +1,62 @@ +#!/bin/bash +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +if [ ! -d testdata ]; then + mkdir testdata +fi +pushd ${DIR}/testdata +GPPORT=${PGPORT} +GPOPTIONS=${PGOPTIONS} +export PGPORT=${PG_PORT} +# set PGOPTIONS to be empty and restart the GP. +# Becuase PGOPTIONS='-c optimizer=off' is sometimes set on gp cluster +# and it will be sent to pg through postgres_fdw, but pg can not +# recognize the 'optimizer' config. PGOPTIONS is not useful for gp +# cluster, it is used by psql. +export PGOPTIONS='' +pgbin="pgsql" + +# install postgres +if [ ! -d "${pgbin}" ] ; then + mkdir ${pgbin} + if [ ! -d postgresql-14.4 ]; then + wget https://ftp.postgresql.org/pub/source/v14.4/postgresql-14.4.tar.gz + tar -xf postgresql-14.4.tar.gz + fi + pushd postgresql-14.4 + ./configure --prefix=${DIR}/testdata/${pgbin} + make -sj$(nproc) MAKELEVEL=0 install + rm -rf postgresql-14.4.tar.gz + popd +fi + +# start postgres 1 +# there may be already a postgres postgres running, anyway, stop it +if [ -d "pgdata" ] ; then + ${pgbin}/bin/pg_ctl -D pgdata stop || true + rm -r pgdata +fi +${pgbin}/bin/initdb -D pgdata +${pgbin}/bin/pg_ctl -D pgdata -l pglog start + +# init postgres 1 +${pgbin}/bin/dropdb --if-exists contrib_regression +${pgbin}/bin/createdb contrib_regression + +# start postgres 2 +# listening to port 5555 +# there may be already a postgres postgres running, anyway, stop it +if [ -d "pgdata2" ] ; then + ${pgbin}/bin/pg_ctl -D pgdata2 stop || true + rm -r pgdata2 +fi +${pgbin}/bin/initdb -D pgdata2 +${pgbin}/bin/pg_ctl -D pgdata2 -l pglog2 -o "-p 5555" start + +# init postgres 2 +${pgbin}/bin/dropdb -p 5555 --if-exists contrib_regression +${pgbin}/bin/createdb -p 5555 contrib_regression + +export PGPORT=${GPPORT} +# export PGOPTIONS=${GPOPTIONS} +popd +gpstop -ar \ No newline at end of file diff --git a/contrib/postgres_fdw/sql/gp2pg_postgres_fdw.sql b/contrib/postgres_fdw/sql/gp2pg_postgres_fdw.sql index 5f87ddfd091..b80277a6656 100644 --- a/contrib/postgres_fdw/sql/gp2pg_postgres_fdw.sql +++ b/contrib/postgres_fdw/sql/gp2pg_postgres_fdw.sql @@ -8,6 +8,10 @@ -- 2.3 gpdb don't support REINDEX CONCURRENTLY. -- 3. gpdb will generate different PLAN from postgres, such as join local table and remote table, select for update/share and so on. +-- start_matchignore +-- m/^DETAIL: Falling back to Postgres-based planner because GPORCA does not support the following feature: .*$ +-- end_matchignore + -- =================================================================== -- create FDW objects -- =================================================================== @@ -303,7 +307,7 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NULL; -- Nu EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 IS NOT NULL; -- NullTest EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE round(abs(c1), 0) = 1; -- FuncExpr EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = -c1; -- OpExpr(l) -EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE 1 = c1!; -- OpExpr(r) +EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE 1 = c1; -- OpExpr(r) EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE (c1 IS NOT NULL) IS DISTINCT FROM (c1 IS NOT NULL); -- DistinctExpr EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = ANY(ARRAY[c2, 1, c1 + 0]); -- ScalarArrayOpExpr EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE c1 = (ARRAY[c1,c2,3])[1]; -- SubscriptingRef diff --git a/contrib/postgres_fdw/sql/gp_postgres_fdw.sql b/contrib/postgres_fdw/sql/gp_postgres_fdw.sql index 6cd0d49d57a..396e0cdf9c5 100644 --- a/contrib/postgres_fdw/sql/gp_postgres_fdw.sql +++ b/contrib/postgres_fdw/sql/gp_postgres_fdw.sql @@ -20,34 +20,6 @@ $d$; CREATE USER MAPPING IF NOT EXISTS FOR CURRENT_USER SERVER loopback; -CREATE EXTENSION postgres_fdw; - -CREATE SERVER testserver1 FOREIGN DATA WRAPPER postgres_fdw; -DO $d$ - BEGIN - EXECUTE $$CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw - OPTIONS (dbname '$$||current_database()||$$', - port '$$||current_setting('port')||$$' - )$$; - EXECUTE $$CREATE SERVER loopback2 FOREIGN DATA WRAPPER postgres_fdw - OPTIONS (dbname '$$||current_database()||$$', - port '$$||current_setting('port')||$$' - )$$; - EXECUTE $$CREATE SERVER loopback3 FOREIGN DATA WRAPPER postgres_fdw - OPTIONS (dbname '$$||current_database()||$$', - port '$$||current_setting('port')||$$' - )$$; - END; -$d$; - -CREATE USER MAPPING FOR public SERVER testserver1 - OPTIONS (user 'value', password 'value'); -CREATE USER MAPPING FOR CURRENT_USER SERVER loopback; -CREATE USER MAPPING FOR CURRENT_USER SERVER loopback2; -CREATE USER MAPPING FOR public SERVER loopback3; - -CREATE SCHEMA "S 1"; - CREATE TABLE table_dist_rand ( f1 int, diff --git a/contrib/postgres_fdw/sql/mpp_postgres_fdw.sql b/contrib/postgres_fdw/sql/mpp_postgres_fdw.sql index 7fefecaf9c2..337cbd9fbf3 100644 --- a/contrib/postgres_fdw/sql/mpp_postgres_fdw.sql +++ b/contrib/postgres_fdw/sql/mpp_postgres_fdw.sql @@ -1,3 +1,8 @@ +-- start_ignore +alter system set optimizer = off; +select pg_reload_conf(); +-- end_ignore + CREATE EXTENSION IF NOT EXISTS postgres_fdw; CREATE SERVER testserver2 FOREIGN DATA WRAPPER postgres_fdw; @@ -135,3 +140,7 @@ explain (costs off) select count(*) from fs1, fs2 where fs1.a = fs2.a and fs1.gp select count(*) from fs1,fs2 where fs1.a = fs2.a and fs1.gp_foreign_server = fs2.gp_foreign_server; reset enable_parallel; +-- start_ignore +alter system reset optimizer; +select pg_reload_conf(); +-- end_ignore \ No newline at end of file diff --git a/contrib/postgres_fdw/sql/postgres_sql/gp2pg_postgres_init.sql b/contrib/postgres_fdw/sql/postgres_sql/gp2pg_postgres_init.sql new file mode 100644 index 00000000000..76673d18b19 --- /dev/null +++ b/contrib/postgres_fdw/sql/postgres_sql/gp2pg_postgres_init.sql @@ -0,0 +1,170 @@ +-- This sql file is used by gp2pg_postgres_fdw test, and it runs in +-- postgres dataserver. + +-- =================================================================== +-- create objects used through FDW pgserver server +-- =================================================================== +SET timezone = 'PST8PDT'; + +CREATE TYPE user_enum AS ENUM ('foo', 'bar', 'buz'); +CREATE SCHEMA "S 1"; +CREATE TABLE "S 1"."T 1" ( + "C 1" int NOT NULL, + c2 int NOT NULL, + c3 text, + c4 timestamptz, + c5 timestamp, + c6 varchar(10), + c7 char(10), + c8 user_enum, + CONSTRAINT t1_pkey PRIMARY KEY ("C 1") +); +CREATE TABLE "S 1"."T 2" ( + c1 int NOT NULL, + c2 text, + CONSTRAINT t2_pkey PRIMARY KEY (c1) +); +CREATE TABLE "S 1"."T 3" ( + c1 int NOT NULL, + c2 int NOT NULL, + c3 text, + CONSTRAINT t3_pkey PRIMARY KEY (c1) +); +CREATE TABLE "S 1"."T 4" ( + c1 int NOT NULL, + c2 int NOT NULL, + c3 text, + CONSTRAINT t4_pkey PRIMARY KEY (c1) +); + +-- Disable autovacuum for these tables to avoid unexpected effects of that +ALTER TABLE "S 1"."T 1" SET (autovacuum_enabled = 'false'); +ALTER TABLE "S 1"."T 2" SET (autovacuum_enabled = 'false'); +ALTER TABLE "S 1"."T 3" SET (autovacuum_enabled = 'false'); +ALTER TABLE "S 1"."T 4" SET (autovacuum_enabled = 'false'); + +INSERT INTO "S 1"."T 1" + SELECT id, + id % 10, + to_char(id, 'FM00000'), + '1970-01-01'::timestamptz + ((id % 100) || ' days')::interval, + '1970-01-01'::timestamp + ((id % 100) || ' days')::interval, + id % 10, + id % 10, + 'foo'::user_enum + FROM generate_series(1, 1000) id; +INSERT INTO "S 1"."T 2" + SELECT id, + 'AAA' || to_char(id, 'FM000') + FROM generate_series(1, 100) id; +INSERT INTO "S 1"."T 3" + SELECT id, + id + 1, + 'AAA' || to_char(id, 'FM000') + FROM generate_series(1, 100) id; +DELETE FROM "S 1"."T 3" WHERE c1 % 2 != 0; -- delete for outer join tests +INSERT INTO "S 1"."T 4" + SELECT id, + id + 1, + 'AAA' || to_char(id, 'FM000') + FROM generate_series(1, 100) id; +DELETE FROM "S 1"."T 4" WHERE c1 % 3 != 0; -- delete for outer join tests + +ANALYZE "S 1"."T 1"; +ANALYZE "S 1"."T 2"; +ANALYZE "S 1"."T 3"; +ANALYZE "S 1"."T 4"; + +-- =================================================================== +-- WHERE with remotely-executable conditions +-- =================================================================== +-- user-defined operator/function +CREATE FUNCTION postgres_fdw_abs(int) RETURNS int AS $$ +BEGIN +RETURN abs($1); +END +$$ LANGUAGE plpgsql IMMUTABLE; + +CREATE OPERATOR === ( + LEFTARG = int, + RIGHTARG = int, + PROCEDURE = int4eq, + COMMUTATOR = === +); + +-- =================================================================== +-- Aggregate and grouping queries +-- =================================================================== +-- User defined function for user defined aggregate, VARIADIC +create function least_accum(anyelement, variadic anyarray) +returns anyelement language sql as + 'select least($1, min($2[i])) from generate_subscripts($2,1) g(i)'; +create aggregate least_agg(variadic items anyarray) ( + stype = anyelement, sfunc = least_accum +); + +-- Testing USING OPERATOR() in ORDER BY within aggregate. +-- For this, we need user defined operators along with operator family and +-- operator class. Create those and then add them in extension. Note that +-- user defined objects are considered unshippable unless they are part of +-- the extension. +create operator public.<^ ( + leftarg = int4, + rightarg = int4, + procedure = int4eq +); + +create operator public.=^ ( + leftarg = int4, + rightarg = int4, + procedure = int4lt +); + +create operator public.>^ ( + leftarg = int4, + rightarg = int4, + procedure = int4gt +); + +create operator family my_op_family using btree; + +create function my_op_cmp(a int, b int) returns int as + $$begin return btint4cmp(a, b); end $$ language plpgsql; + +create operator class my_op_class for type int using btree family my_op_family as + operator 1 public.<^, + operator 3 public.=^, + operator 5 public.>^, + function 1 my_op_cmp(int, int); + + + -- Test that trigger on remote table works as expected +CREATE OR REPLACE FUNCTION "S 1".F_BRTRIG() RETURNS trigger AS $$ +BEGIN + NEW.c3 = NEW.c3 || '_trig_update'; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +-- Test various RETURN statements in BEFORE triggers. +CREATE FUNCTION trig_row_before_insupdate() RETURNS TRIGGER AS $$ + BEGIN + NEW.f2 := NEW.f2 || ' triggered !'; + RETURN NEW; + END +$$ language plpgsql; + +-- Test with a trigger returning NULL +CREATE FUNCTION trig_null() RETURNS TRIGGER AS $$ + BEGIN + RETURN NULL; + END +$$ language plpgsql; + +-- Test that remote triggers work with insert tuple routing +create function br_insert_trigfunc() returns trigger as $$ +begin + new.b := new.b || ' triggered !'; + return new; +end +$$ language plpgsql; \ No newline at end of file diff --git a/contrib/postgres_fdw/sql/postgres_sql/mpp_gp2pg_postgres_init_1.sql b/contrib/postgres_fdw/sql/postgres_sql/mpp_gp2pg_postgres_init_1.sql new file mode 100644 index 00000000000..ed3f62f9a54 --- /dev/null +++ b/contrib/postgres_fdw/sql/postgres_sql/mpp_gp2pg_postgres_init_1.sql @@ -0,0 +1,47 @@ +-- This sql file is used by mpp_gp2pg_postgres_fdw test, and it runs in +-- postgres server. + +-- =================================================================== +-- create objects used through FDW pgserver server +-- =================================================================== +SET timezone = 'PST8PDT'; + +CREATE SCHEMA "MPP_S 1"; +CREATE TABLE "MPP_S 1"."T 1" ( + c1 int, + c2 int +); + +CREATE TABLE "MPP_S 1"."T 2" ( + c1 int, + c2 int, + c3 smallint, + c4 bigint, + c5 real, + c6 double precision, + c7 numeric +); + +-- Disable autovacuum for these tables to avoid unexpected effects of that +ALTER TABLE "MPP_S 1"."T 1" SET (autovacuum_enabled = 'false'); +ALTER TABLE "MPP_S 1"."T 2" SET (autovacuum_enabled = 'false'); + +INSERT INTO "MPP_S 1"."T 1" + SELECT id, + id % 2 + FROM generate_series(1, 5) id; + +INSERT INTO "MPP_S 1"."T 2" (c1, c2, c3, c4) + SELECT id, + id % 10, + id, + id + FROM generate_series(1, 500) id; + +UPDATE "MPP_S 1"."T 2" + SET c5 = c1 * 0.001, + c6 = c1 * 0.001, + c7 = c1 * 0.001; + +ANALYZE "MPP_S 1"."T 1"; +ANALYZE "MPP_S 1"."T 2"; \ No newline at end of file diff --git a/contrib/postgres_fdw/sql/postgres_sql/mpp_gp2pg_postgres_init_2.sql b/contrib/postgres_fdw/sql/postgres_sql/mpp_gp2pg_postgres_init_2.sql new file mode 100644 index 00000000000..22a69a18b60 --- /dev/null +++ b/contrib/postgres_fdw/sql/postgres_sql/mpp_gp2pg_postgres_init_2.sql @@ -0,0 +1,47 @@ +-- This sql file is used by mpp_gp2pg_postgres_fdw test, and it runs in +-- postgres server. + +-- =================================================================== +-- create objects used through FDW pgserver server +-- =================================================================== +SET timezone = 'PST8PDT'; + +CREATE SCHEMA "MPP_S 1"; +CREATE TABLE "MPP_S 1"."T 1" ( + c1 int, + c2 int +); + +CREATE TABLE "MPP_S 1"."T 2" ( + c1 int, + c2 int, + c3 smallint, + c4 bigint, + c5 real, + c6 double precision, + c7 numeric +); + +-- Disable autovacuum for these tables to avoid unexpected effects of that +ALTER TABLE "MPP_S 1"."T 1" SET (autovacuum_enabled = 'false'); +ALTER TABLE "MPP_S 1"."T 2" SET (autovacuum_enabled = 'false'); + +INSERT INTO "MPP_S 1"."T 1" + SELECT id, + id % 2 + FROM generate_series(6, 10) id; + +INSERT INTO "MPP_S 1"."T 2" (c1, c2, c3, c4) + SELECT id, + id % 10, + id, + id + FROM generate_series(501, 1000) id; + +UPDATE "MPP_S 1"."T 2" + SET c5 = c1 * 0.001, + c6 = c1 * 0.001, + c7 = c1 * 0.001; + +ANALYZE "MPP_S 1"."T 1"; +ANALYZE "MPP_S 1"."T 2"; \ No newline at end of file