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

Commitc704977

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 parent19f3266 commitc704977

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
@@ -65,19 +65,19 @@ CREATE FUNCTION do_analyze() RETURNS VOID VOLATILE LANGUAGE SQL
6565
AS 'ANALYZE pg_am';
6666
CREATE FUNCTION wrap_do_analyze(c INT) RETURNS INT IMMUTABLE LANGUAGE SQL
6767
AS 'SELECT $1 FROM do_analyze()';
68-
CREATE INDEX ONvactst(wrap_do_analyze(i));
69-
INSERT INTOvactst VALUES (1), (2);
70-
ANALYZEvactst;
68+
CREATE INDEX ONvaccluster(wrap_do_analyze(i));
69+
INSERT INTOvaccluster VALUES (1), (2);
70+
ANALYZEvaccluster;
7171
ERROR: ANALYZE cannot be executed from VACUUM or ANALYZE
7272
CONTEXT: SQL function "do_analyze" statement 1
7373
SQL function "wrap_do_analyze" statement 1
7474
VACUUM FULL pg_am;
7575
VACUUM FULL pg_class;
7676
VACUUM FULL pg_database;
7777
VACUUM FULL vaccluster;
78-
VACUUM FULL vactst;
7978
ERROR: ANALYZE cannot be executed from VACUUM or ANALYZE
8079
CONTEXT: SQL function "do_analyze" statement 1
8180
SQL function "wrap_do_analyze" statement 1
81+
VACUUM FULL vactst;
8282
DROP TABLE vaccluster;
8383
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