]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Tweak placement of explicit ANALYZE commands in the regression tests.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 11 Dec 2013 20:08:45 +0000 (15:08 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 11 Dec 2013 20:08:45 +0000 (15:08 -0500)
Make the COPY test, which loads most of the large static tables used in
the tests, also explicitly ANALYZE those tables.  This allows us to get
rid of various ad-hoc, and rather redundant, ANALYZE commands that had
gotten stuck into various test scripts over time to ensure we got
consistent plan choices.  (We could have done a database-wide ANALYZE,
but that would cause stats to get attached to the small static tables
too, which results in plan changes compared to the historical behavior.
I'm not sure that's a good idea, so not going that far for now.)

Back-patch to 9.0, since 9.0 and 9.1 are currently sometimes failing
regression tests for lack of an "ANALYZE tenk1" in the subselect test.
There's no need for this in 8.4 since we didn't print any plans back
then.

src/test/regress/expected/alter_table.out
src/test/regress/expected/join.out
src/test/regress/input/copy.source
src/test/regress/output/copy.source
src/test/regress/sql/alter_table.sql
src/test/regress/sql/join.sql

index 18ac1a1ac2de82d9043143a4ee07b3bfdec32cd8..0da5ec58b5629e24c30189cd78a997faefc78bb8 100644 (file)
@@ -134,7 +134,6 @@ ALTER INDEX tmp_onek_unique1 RENAME TO onek_unique1;
 CREATE VIEW tmp_view (unique1) AS SELECT unique1 FROM tenk1;
 ALTER TABLE tmp_view RENAME TO tmp_view_new;
 -- hack to ensure we get an indexscan here
-ANALYZE tenk1;
 set enable_seqscan to off;
 set enable_bitmapscan to off;
 -- 5 values, sorted 
index be3df5e4735e32e32373fcbca8b478916d69b094..13001807d1d2d89587d0436a83a83d45295dfe2c 100644 (file)
@@ -2129,7 +2129,6 @@ on (x1 = xx1) where (xx2 is not null);
 -- regression test: check for bug with propagation of implied equality
 -- to outside an IN
 --
-analyze tenk1;         -- ensure we get consistent plans here
 select count(*) from tenk1 a where unique1 in
   (select unique1 from tenk1 b join tenk1 c using (unique1)
    where b.unique2 = 42);
index 376329d250dbb2dbc536303496ff7ccfc5348167..2146cba211de49c1e9d9af00b395353da15286fb 100644 (file)
@@ -60,6 +60,31 @@ COPY array_op_test FROM '@abs_srcdir@/data/array.data';
 
 COPY array_index_op_test FROM '@abs_srcdir@/data/array.data';
 
+-- analyze all the data we just loaded, to ensure plan consistency
+-- in later tests
+
+ANALYZE aggtest;
+ANALYZE onek;
+ANALYZE tenk1;
+ANALYZE slow_emp4000;
+ANALYZE person;
+ANALYZE emp;
+ANALYZE student;
+ANALYZE stud_emp;
+ANALYZE road;
+ANALYZE real_city;
+ANALYZE hash_i4_heap;
+ANALYZE hash_name_heap;
+ANALYZE hash_txt_heap;
+ANALYZE hash_f8_heap;
+ANALYZE test_tsvector;
+ANALYZE bt_i4_heap;
+ANALYZE bt_name_heap;
+ANALYZE bt_txt_heap;
+ANALYZE bt_f8_heap;
+ANALYZE array_op_test;
+ANALYZE array_index_op_test;
+
 --- test copying in CSV mode with various styles
 --- of embedded line ending characters
 
index 5a88d6ef20ac705ede4c1089923ba3f4647efa3c..cb0c9a37d9b12c38fdbc73b76854920cdb488665 100644 (file)
@@ -34,6 +34,29 @@ COPY bt_txt_heap FROM '@abs_srcdir@/data/desc.data';
 COPY bt_f8_heap FROM '@abs_srcdir@/data/hash.data';
 COPY array_op_test FROM '@abs_srcdir@/data/array.data';
 COPY array_index_op_test FROM '@abs_srcdir@/data/array.data';
+-- analyze all the data we just loaded, to ensure plan consistency
+-- in later tests
+ANALYZE aggtest;
+ANALYZE onek;
+ANALYZE tenk1;
+ANALYZE slow_emp4000;
+ANALYZE person;
+ANALYZE emp;
+ANALYZE student;
+ANALYZE stud_emp;
+ANALYZE road;
+ANALYZE real_city;
+ANALYZE hash_i4_heap;
+ANALYZE hash_name_heap;
+ANALYZE hash_txt_heap;
+ANALYZE hash_f8_heap;
+ANALYZE test_tsvector;
+ANALYZE bt_i4_heap;
+ANALYZE bt_name_heap;
+ANALYZE bt_txt_heap;
+ANALYZE bt_f8_heap;
+ANALYZE array_op_test;
+ANALYZE array_index_op_test;
 --- test copying in CSV mode with various styles
 --- of embedded line ending characters
 create temp table copytest (
index c9c3f7e0e09d51659e603af6ac81043cb349d88b..0a41fd85dc62140c3232b89ce187bfbb1daa9f17 100644 (file)
@@ -173,7 +173,6 @@ CREATE VIEW tmp_view (unique1) AS SELECT unique1 FROM tenk1;
 ALTER TABLE tmp_view RENAME TO tmp_view_new;
 
 -- hack to ensure we get an indexscan here
-ANALYZE tenk1;
 set enable_seqscan to off;
 set enable_bitmapscan to off;
 -- 5 values, sorted 
index 9328c8c250301d02d5ec980520e951baa5f20ab1..e92fe28ec6988241780d4c7bf31c73c80baf920f 100644 (file)
@@ -330,8 +330,6 @@ on (x1 = xx1) where (xx2 is not null);
 -- regression test: check for bug with propagation of implied equality
 -- to outside an IN
 --
-analyze tenk1;         -- ensure we get consistent plans here
-
 select count(*) from tenk1 a where unique1 in
   (select unique1 from tenk1 b join tenk1 c using (unique1)
    where b.unique2 = 42);