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

Commit d6d5f67

Browse files
committed
Modify create_index regression test to avoid intermittent failures.
We have been seeing intermittent buildfarm failures due to a query sometimes not using an index-only scan plan, because a background auto-ANALYZE prevented the table's all-visible bits from being set immediately, thereby causing the estimated cost of an index-only scan to go up considerably. Adjust the test case so that a bitmap index scan is preferred instead, which serves equally well for the purpose the test case is actually meant for. (Of course, it would be better to eliminate the interference from auto-ANALYZE, but I see no low-risk way to do that, so any such fix will have to be left for 9.3 or later.)
1 parent 9fa82c9 commit d6d5f67

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

src/test/regress/expected/create_index.out

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2605,21 +2605,23 @@ DROP TABLE onek_with_null;
26052605
CREATE TABLE dupindexcols AS
26062606
SELECT unique1 as id, stringu2::text as f1 FROM tenk1;
26072607
CREATE INDEX dupindexcols_i ON dupindexcols (f1, id, f1 text_pattern_ops);
2608-
VACUUM ANALYZE dupindexcols;
2608+
ANALYZE dupindexcols;
26092609
EXPLAIN (COSTS OFF)
26102610
SELECT count(*) FROM dupindexcols
2611-
WHERE f1 > 'MA' and id < 1000 and f1 ~<~ 'YX';
2612-
QUERY PLAN
2613-
---------------------------------------------------------------------------------
2614-
Aggregate
2615-
-> Index Only Scan using dupindexcols_i on dupindexcols
2616-
Index Cond: ((f1 > 'MA'::text) AND (id < 1000) AND (f1 ~<~ 'YX'::text))
2617-
(3 rows)
2611+
WHERE f1 > 'WA' and id < 1000 and f1 ~<~ 'YX';
2612+
QUERY PLAN
2613+
---------------------------------------------------------------------------------------
2614+
Aggregate
2615+
-> Bitmap Heap Scan on dupindexcols
2616+
Recheck Cond: ((f1 > 'WA'::text) AND (id < 1000) AND (f1 ~<~ 'YX'::text))
2617+
-> Bitmap Index Scan on dupindexcols_i
2618+
Index Cond: ((f1 > 'WA'::text) AND (id < 1000) AND (f1 ~<~ 'YX'::text))
2619+
(5 rows)
26182620

26192621
SELECT count(*) FROM dupindexcols
2620-
WHERE f1 > 'MA' and id < 1000 and f1 ~<~ 'YX';
2622+
WHERE f1 > 'WA' and id < 1000 and f1 ~<~ 'YX';
26212623
count
26222624
-------
2623-
497
2625+
97
26242626
(1 row)
26252627

src/test/regress/sql/create_index.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -865,10 +865,10 @@ DROP TABLE onek_with_null;
865865
CREATE TABLE dupindexcols AS
866866
SELECT unique1 as id, stringu2::text as f1 FROM tenk1;
867867
CREATE INDEX dupindexcols_i ON dupindexcols (f1, id, f1 text_pattern_ops);
868-
VACUUM ANALYZE dupindexcols;
868+
ANALYZE dupindexcols;
869869

870870
EXPLAIN (COSTS OFF)
871871
SELECT count(*) FROM dupindexcols
872-
WHERE f1 > 'MA' and id < 1000 and f1 ~<~ 'YX';
872+
WHERE f1 > 'WA' and id < 1000 and f1 ~<~ 'YX';
873873
SELECT count(*) FROM dupindexcols
874-
WHERE f1 > 'MA' and id < 1000 and f1 ~<~ 'YX';
874+
WHERE f1 > 'WA' and id < 1000 and f1 ~<~ 'YX';

0 commit comments

Comments
 (0)