diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2012-04-25 22:57:48 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2012-04-25 22:57:48 -0400 |
commit | d6d5f67b5b98b1685f9158e9d00a726afb2ae789 (patch) | |
tree | 788809a220ba82b5ee884b0ce70ec717f2300d64 | |
parent | 9fa82c980935ef4aee18fabe8da20ae2198b052a (diff) | |
download | postgresql-d6d5f67b5b98b1685f9158e9d00a726afb2ae789.tar.gz postgresql-d6d5f67b5b98b1685f9158e9d00a726afb2ae789.zip |
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.)
-rw-r--r-- | src/test/regress/expected/create_index.out | 22 | ||||
-rw-r--r-- | src/test/regress/sql/create_index.sql | 6 |
2 files changed, 15 insertions, 13 deletions
diff --git a/src/test/regress/expected/create_index.out b/src/test/regress/expected/create_index.out index 36609c5bbf9..4411d250a71 100644 --- a/src/test/regress/expected/create_index.out +++ b/src/test/regress/expected/create_index.out @@ -2605,21 +2605,23 @@ DROP TABLE onek_with_null; CREATE TABLE dupindexcols AS SELECT unique1 as id, stringu2::text as f1 FROM tenk1; CREATE INDEX dupindexcols_i ON dupindexcols (f1, id, f1 text_pattern_ops); -VACUUM ANALYZE dupindexcols; +ANALYZE dupindexcols; EXPLAIN (COSTS OFF) SELECT count(*) FROM dupindexcols - WHERE f1 > 'MA' and id < 1000 and f1 ~<~ 'YX'; - QUERY PLAN ---------------------------------------------------------------------------------- - Aggregate - -> Index Only Scan using dupindexcols_i on dupindexcols - Index Cond: ((f1 > 'MA'::text) AND (id < 1000) AND (f1 ~<~ 'YX'::text)) -(3 rows) + WHERE f1 > 'WA' and id < 1000 and f1 ~<~ 'YX'; + QUERY PLAN +--------------------------------------------------------------------------------------- + Aggregate + -> Bitmap Heap Scan on dupindexcols + Recheck Cond: ((f1 > 'WA'::text) AND (id < 1000) AND (f1 ~<~ 'YX'::text)) + -> Bitmap Index Scan on dupindexcols_i + Index Cond: ((f1 > 'WA'::text) AND (id < 1000) AND (f1 ~<~ 'YX'::text)) +(5 rows) SELECT count(*) FROM dupindexcols - WHERE f1 > 'MA' and id < 1000 and f1 ~<~ 'YX'; + WHERE f1 > 'WA' and id < 1000 and f1 ~<~ 'YX'; count ------- - 497 + 97 (1 row) diff --git a/src/test/regress/sql/create_index.sql b/src/test/regress/sql/create_index.sql index deb19897265..62d05d06058 100644 --- a/src/test/regress/sql/create_index.sql +++ b/src/test/regress/sql/create_index.sql @@ -865,10 +865,10 @@ DROP TABLE onek_with_null; CREATE TABLE dupindexcols AS SELECT unique1 as id, stringu2::text as f1 FROM tenk1; CREATE INDEX dupindexcols_i ON dupindexcols (f1, id, f1 text_pattern_ops); -VACUUM ANALYZE dupindexcols; +ANALYZE dupindexcols; EXPLAIN (COSTS OFF) SELECT count(*) FROM dupindexcols - WHERE f1 > 'MA' and id < 1000 and f1 ~<~ 'YX'; + WHERE f1 > 'WA' and id < 1000 and f1 ~<~ 'YX'; SELECT count(*) FROM dupindexcols - WHERE f1 > 'MA' and id < 1000 and f1 ~<~ 'YX'; + WHERE f1 > 'WA' and id < 1000 and f1 ~<~ 'YX'; |