Commit 4fa39646 authored by Robert Haas's avatar Robert Haas

postgres_fdw: Third attempt to stabilize regression tests.

Commit 1bc0100d added this test,
and commit 882ea509 tried to
stabilize it.  There were still failures, so commit
958e20e4 tried again to stabilize
it.  That approach is still failing on jaguarundi, though, so
back it out and try something else.  Specifically, instead of
disabling remote estimates for the table in question, let's tell
autovacuum to leave it alone.

Etsuro Fujita

Discussion: http://postgr.es/m/5A82DCCE.3060107@lab.ntt.co.jp
parent c161ea13
...@@ -35,6 +35,9 @@ CREATE TABLE "S 1"."T 1" ( ...@@ -35,6 +35,9 @@ CREATE TABLE "S 1"."T 1" (
c8 user_enum, c8 user_enum,
CONSTRAINT t1_pkey PRIMARY KEY ("C 1") CONSTRAINT t1_pkey PRIMARY KEY ("C 1")
); );
-- "S 1"."T 1" will be heavily updated below, so disable autovacuum for
-- the table to avoid unexpected effects of that
ALTER TABLE "S 1"."T 1" SET (autovacuum_enabled = 'false');
CREATE TABLE "S 1"."T 2" ( CREATE TABLE "S 1"."T 2" (
c1 int NOT NULL, c1 int NOT NULL,
c2 text, c2 text,
...@@ -4244,10 +4247,6 @@ explain (verbose, costs off) select * from ft3 f, loct3 l ...@@ -4244,10 +4247,6 @@ explain (verbose, costs off) select * from ft3 f, loct3 l
-- =================================================================== -- ===================================================================
-- test writable foreign table stuff -- test writable foreign table stuff
-- =================================================================== -- ===================================================================
-- Autovacuum on the remote side might affect remote estimates,
-- so use local stats on ft2 as well
ALTER FOREIGN TABLE ft2 OPTIONS (SET use_remote_estimate 'false');
ANALYZE ft2;
EXPLAIN (verbose, costs off) EXPLAIN (verbose, costs off)
INSERT INTO ft2 (c1,c2,c3) SELECT c1+1000,c2+100, c3 || c3 FROM ft2 LIMIT 20; INSERT INTO ft2 (c1,c2,c3) SELECT c1+1000,c2+100, c3 || c3 FROM ft2 LIMIT 20;
QUERY PLAN QUERY PLAN
...@@ -5524,32 +5523,32 @@ UPDATE ft2 SET c3 = 'baz' ...@@ -5524,32 +5523,32 @@ UPDATE ft2 SET c3 = 'baz'
FROM ft4 INNER JOIN ft5 ON (ft4.c1 = ft5.c1) FROM ft4 INNER JOIN ft5 ON (ft4.c1 = ft5.c1)
WHERE ft2.c1 > 2000 AND ft2.c2 === ft4.c1 WHERE ft2.c1 > 2000 AND ft2.c2 === ft4.c1
RETURNING ft2.*, ft4.*, ft5.*; -- can't be pushed down RETURNING ft2.*, ft4.*, ft5.*; -- can't be pushed down
QUERY PLAN QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Update on public.ft2 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 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 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 -> Nested Loop
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: 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
Hash Cond: (ft4.c1 = ft5.c1) Join Filter: (ft2.c2 === ft4.c1)
-> 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
-> Foreign Scan -> 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: ft4.*, ft4.c1, ft4.c2, ft4.c3, ft5.*, ft5.c1, ft5.c2, ft5.c3
Filter: (ft2.c2 === ft4.c1) Relations: (public.ft4) INNER JOIN (public.ft5)
Relations: (public.ft2) INNER JOIN (public.ft4) Remote SQL: SELECT CASE WHEN (r2.*)::text IS NOT NULL THEN ROW(r2.c1, r2.c2, r2.c3) END, r2.c1, r2.c2, r2.c3, CASE WHEN (r3.*)::text IS NOT NULL THEN ROW(r3.c1, r3.c2, r3.c3) END, r3.c1, r3.c2, r3.c3 FROM ("S 1"."T 3" r2 INNER JOIN "S 1"."T 4" r3 ON (((r2.c1 = r3.c1))))
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 -> Hash Join
-> Nested Loop Output: ft4.*, ft4.c1, ft4.c2, ft4.c3, ft5.*, ft5.c1, ft5.c2, ft5.c3
Output: ft2.c1, ft2.c2, ft2.c4, ft2.c5, ft2.c6, ft2.c7, ft2.c8, ft2.ctid, ft4.*, ft4.c1, ft4.c2, ft4.c3 Hash Cond: (ft4.c1 = ft5.c1)
-> 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
-> Foreign Scan on public.ft4 -> Foreign Scan on public.ft4
Output: ft4.*, ft4.c1, ft4.c2, ft4.c3 Output: ft4.*, ft4.c1, ft4.c2, ft4.c3
Remote SQL: SELECT c1, c2, c3 FROM "S 1"."T 3" Remote SQL: SELECT c1, c2, c3 FROM "S 1"."T 3"
-> Hash -> Hash
Output: ft5.*, ft5.c1, ft5.c2, ft5.c3 Output: ft5.*, ft5.c1, ft5.c2, ft5.c3
-> Foreign Scan on public.ft5 -> Foreign Scan on public.ft5
Output: ft5.*, ft5.c1, ft5.c2, ft5.c3 Output: ft5.*, ft5.c1, ft5.c2, ft5.c3
Remote SQL: SELECT c1, c2, c3 FROM "S 1"."T 4" Remote SQL: SELECT c1, c2, c3 FROM "S 1"."T 4"
(24 rows) (24 rows)
UPDATE ft2 SET c3 = 'baz' UPDATE ft2 SET c3 = 'baz'
...@@ -6003,9 +6002,7 @@ select c2, count(*) from "S 1"."T 1" where c2 < 500 group by 1 order by 1; ...@@ -6003,9 +6002,7 @@ select c2, count(*) from "S 1"."T 1" where c2 < 500 group by 1 order by 1;
407 | 100 407 | 100
(13 rows) (13 rows)
-- Go back to use remote-estimate mode on ft2
VACUUM ANALYZE "S 1"."T 1"; VACUUM ANALYZE "S 1"."T 1";
ALTER FOREIGN TABLE ft2 OPTIONS (SET use_remote_estimate 'true');
-- Above DMLs add data with c6 as NULL in ft1, so test ORDER BY NULLS LAST and NULLs -- Above DMLs add data with c6 as NULL in ft1, so test ORDER BY NULLS LAST and NULLs
-- FIRST behavior here. -- FIRST behavior here.
-- ORDER BY DESC NULLS LAST options -- ORDER BY DESC NULLS LAST options
......
...@@ -39,6 +39,9 @@ CREATE TABLE "S 1"."T 1" ( ...@@ -39,6 +39,9 @@ CREATE TABLE "S 1"."T 1" (
c8 user_enum, c8 user_enum,
CONSTRAINT t1_pkey PRIMARY KEY ("C 1") CONSTRAINT t1_pkey PRIMARY KEY ("C 1")
); );
-- "S 1"."T 1" will be heavily updated below, so disable autovacuum for
-- the table to avoid unexpected effects of that
ALTER TABLE "S 1"."T 1" SET (autovacuum_enabled = 'false');
CREATE TABLE "S 1"."T 2" ( CREATE TABLE "S 1"."T 2" (
c1 int NOT NULL, c1 int NOT NULL,
c2 text, c2 text,
...@@ -1068,11 +1071,6 @@ explain (verbose, costs off) select * from ft3 f, loct3 l ...@@ -1068,11 +1071,6 @@ explain (verbose, costs off) select * from ft3 f, loct3 l
-- =================================================================== -- ===================================================================
-- test writable foreign table stuff -- test writable foreign table stuff
-- =================================================================== -- ===================================================================
-- Autovacuum on the remote side might affect remote estimates,
-- so use local stats on ft2 as well
ALTER FOREIGN TABLE ft2 OPTIONS (SET use_remote_estimate 'false');
ANALYZE ft2;
EXPLAIN (verbose, costs off) EXPLAIN (verbose, costs off)
INSERT INTO ft2 (c1,c2,c3) SELECT c1+1000,c2+100, c3 || c3 FROM ft2 LIMIT 20; INSERT INTO ft2 (c1,c2,c3) SELECT c1+1000,c2+100, c3 || c3 FROM ft2 LIMIT 20;
INSERT INTO ft2 (c1,c2,c3) SELECT c1+1000,c2+100, c3 || c3 FROM ft2 LIMIT 20; INSERT INTO ft2 (c1,c2,c3) SELECT c1+1000,c2+100, c3 || c3 FROM ft2 LIMIT 20;
...@@ -1213,9 +1211,7 @@ commit; ...@@ -1213,9 +1211,7 @@ commit;
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1; select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
select c2, count(*) from "S 1"."T 1" where c2 < 500 group by 1 order by 1; select c2, count(*) from "S 1"."T 1" where c2 < 500 group by 1 order by 1;
-- Go back to use remote-estimate mode on ft2
VACUUM ANALYZE "S 1"."T 1"; VACUUM ANALYZE "S 1"."T 1";
ALTER FOREIGN TABLE ft2 OPTIONS (SET use_remote_estimate 'true');
-- Above DMLs add data with c6 as NULL in ft1, so test ORDER BY NULLS LAST and NULLs -- Above DMLs add data with c6 as NULL in ft1, so test ORDER BY NULLS LAST and NULLs
-- FIRST behavior here. -- FIRST behavior here.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment