Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c2c537c

Browse files
committed
Temporarily instrument postgres_fdw test to look for statistics changes.
It seems fairly hard to explain recent buildfarm failures without the theory that something is doing an ANALYZE behind our backs. Probe for this directly to see if it's true. In principle the outputs of these queries should be stable, since the table in question is small enough that ANALYZE's sample will include all rows. But even if that turns out to be wrong, we can put up with some failures for a bit. I don't intend to leave this here indefinitely. Discussion: https://postgr.es/m/25502.1520277552@sss.pgh.pa.us
1 parent 722408b commit c2c537c

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

contrib/postgres_fdw/expected/postgres_fdw.out

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,23 @@ ANALYZE "S 1"."T 1";
8787
ANALYZE "S 1"."T 2";
8888
ANALYZE "S 1"."T 3";
8989
ANALYZE "S 1"."T 4";
90+
-- record relpages for T 1
91+
create temp table save_t_1_relpages as
92+
select relpages as old_relpages from pg_class where relname = 'T 1';
93+
select relpages - (select old_relpages from save_t_1_relpages) as pg_delta,
94+
reltuples from pg_class where relname = 'T 1';
95+
pg_delta | reltuples
96+
----------+-----------
97+
0 | 1000
98+
(1 row)
99+
100+
select (histogram_bounds::text::int[])[array_length(histogram_bounds,1)]
101+
from pg_stats where tablename = 'T 1' and attname = 'C 1';
102+
histogram_bounds
103+
------------------
104+
1000
105+
(1 row)
106+
90107
-- ===================================================================
91108
-- create foreign tables
92109
-- ===================================================================
@@ -5520,6 +5537,20 @@ UPDATE ft2 SET c3 = 'bar' WHERE postgres_fdw_abs(c1) > 2000 RETURNING *;
55205537
2010 | 0 | bar | | | | ft2 |
55215538
(10 rows)
55225539

5540+
select relpages - (select old_relpages from save_t_1_relpages) as pg_delta,
5541+
reltuples from pg_class where relname = 'T 1';
5542+
pg_delta | reltuples
5543+
----------+-----------
5544+
0 | 1000
5545+
(1 row)
5546+
5547+
select (histogram_bounds::text::int[])[array_length(histogram_bounds,1)]
5548+
from pg_stats where tablename = 'T 1' and attname = 'C 1';
5549+
histogram_bounds
5550+
------------------
5551+
1000
5552+
(1 row)
5553+
55235554
EXPLAIN (verbose, costs off)
55245555
UPDATE ft2 SET c3 = 'baz'
55255556
FROM ft4 INNER JOIN ft5 ON (ft4.c1 = ft5.c1)

contrib/postgres_fdw/sql/postgres_fdw.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@ ANALYZE "S 1"."T 2";
9595
ANALYZE "S 1"."T 3";
9696
ANALYZE "S 1"."T 4";
9797

98+
-- record relpages for T 1
99+
create temp table save_t_1_relpages as
100+
select relpages as old_relpages from pg_class where relname = 'T 1';
101+
102+
select relpages - (select old_relpages from save_t_1_relpages) as pg_delta,
103+
reltuples from pg_class where relname = 'T 1';
104+
select (histogram_bounds::text::int[])[array_length(histogram_bounds,1)]
105+
from pg_stats where tablename = 'T 1' and attname = 'C 1';
106+
98107
-- ===================================================================
99108
-- create foreign tables
100109
-- ===================================================================
@@ -1139,6 +1148,10 @@ INSERT INTO ft2 (c1,c2,c3)
11391148
EXPLAIN (verbose, costs off)
11401149
UPDATE ft2 SET c3 = 'bar' WHERE postgres_fdw_abs(c1) > 2000 RETURNING *; -- can't be pushed down
11411150
UPDATE ft2 SET c3 = 'bar' WHERE postgres_fdw_abs(c1) > 2000 RETURNING *;
1151+
select relpages - (select old_relpages from save_t_1_relpages) as pg_delta,
1152+
reltuples from pg_class where relname = 'T 1';
1153+
select (histogram_bounds::text::int[])[array_length(histogram_bounds,1)]
1154+
from pg_stats where tablename = 'T 1' and attname = 'C 1';
11421155
EXPLAIN (verbose, costs off)
11431156
UPDATE ft2 SET c3 = 'baz'
11441157
FROM ft4 INNER JOIN ft5 ON (ft4.c1 = ft5.c1)

0 commit comments

Comments
 (0)