Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5b1e4c1

Browse files
committed
Avoid unexpected slowdown in vacuum regression test.
I noticed the "vacuum" regression test taking really significantly longerthan it used to on a slow machine. Investigation pointed the finger atcommite415b46, which added creation ofan index using an extremely expensive index function. That function wasevidently meant to be applied only twice ... but the test re-used anexisting test table, which up till a couple lines before that had had overtwo thousand rows. Depending on timing of the concurrent regression tests,the intervening VACUUMs might have been unable to remove thoserecently-dead rows, and then the index build would need to create indexentries for them too, leading to the wrap_do_analyze() function beingexecuted 2000+ times not twice. Avoid this by using a different tablethat is guaranteed to have only the intended two rows in it.Back-patch to 9.0, like the commit that created the problem.
1 parent2e49461 commit5b1e4c1

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

‎src/test/regress/expected/vacuum.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,19 @@ CREATE FUNCTION do_analyze() RETURNS VOID VOLATILE LANGUAGE SQL
6666
AS 'ANALYZE pg_am';
6767
CREATE FUNCTION wrap_do_analyze(c INT) RETURNS INT IMMUTABLE LANGUAGE SQL
6868
AS 'SELECT $1 FROM do_analyze()';
69-
CREATE INDEX ONvactst(wrap_do_analyze(i));
70-
INSERT INTOvactst VALUES (1), (2);
71-
ANALYZEvactst;
69+
CREATE INDEX ONvaccluster(wrap_do_analyze(i));
70+
INSERT INTOvaccluster VALUES (1), (2);
71+
ANALYZEvaccluster;
7272
ERROR: ANALYZE cannot be executed from VACUUM or ANALYZE
7373
CONTEXT: SQL function "do_analyze" statement 1
7474
SQL function "wrap_do_analyze" statement 1
7575
VACUUM FULL pg_am;
7676
VACUUM FULL pg_class;
7777
VACUUM FULL pg_database;
7878
VACUUM FULL vaccluster;
79-
VACUUM FULL vactst;
8079
ERROR: ANALYZE cannot be executed from VACUUM or ANALYZE
8180
CONTEXT: SQL function "do_analyze" statement 1
8281
SQL function "wrap_do_analyze" statement 1
82+
VACUUM FULL vactst;
8383
DROP TABLE vaccluster;
8484
DROP TABLE vactst;

‎src/test/regress/sql/vacuum.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ CREATE FUNCTION do_analyze() RETURNS VOID VOLATILE LANGUAGE SQL
5050
AS'ANALYZE pg_am';
5151
CREATEFUNCTIONwrap_do_analyze(cINT) RETURNSINT IMMUTABLE LANGUAGE SQL
5252
AS'SELECT $1 FROM do_analyze()';
53-
CREATEINDEXONvactst(wrap_do_analyze(i));
54-
INSERT INTOvactstVALUES (1), (2);
55-
ANALYZEvactst;
53+
CREATEINDEXONvaccluster(wrap_do_analyze(i));
54+
INSERT INTOvacclusterVALUES (1), (2);
55+
ANALYZEvaccluster;
5656

5757
VACUUM FULL pg_am;
5858
VACUUM FULL pg_class;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp