mirror of
https://github.com/postgres/postgres.git
synced 2025-05-21 15:54:08 +03:00
Avoid unexpected slowdown in vacuum regression test.
I noticed the "vacuum" regression test taking really significantly longer than it used to on a slow machine. Investigation pointed the finger at commit e415b469b33ba328765e39fd62edcd28f30d9c3c, which added creation of an index using an extremely expensive index function. That function was evidently meant to be applied only twice ... but the test re-used an existing test table, which up till a couple lines before that had had over two thousand rows. Depending on timing of the concurrent regression tests, the intervening VACUUMs might have been unable to remove those recently-dead rows, and then the index build would need to create index entries for them too, leading to the wrap_do_analyze() function being executed 2000+ times not twice. Avoid this by using a different table that is guaranteed to have only the intended two rows in it. Back-patch to 9.0, like the commit that created the problem.
This commit is contained in:
parent
41479f34dd
commit
e9f9ebfe65
@ -66,9 +66,9 @@ CREATE FUNCTION do_analyze() RETURNS VOID VOLATILE LANGUAGE SQL
|
|||||||
AS 'ANALYZE pg_am';
|
AS 'ANALYZE pg_am';
|
||||||
CREATE FUNCTION wrap_do_analyze(c INT) RETURNS INT IMMUTABLE LANGUAGE SQL
|
CREATE FUNCTION wrap_do_analyze(c INT) RETURNS INT IMMUTABLE LANGUAGE SQL
|
||||||
AS 'SELECT $1 FROM do_analyze()';
|
AS 'SELECT $1 FROM do_analyze()';
|
||||||
CREATE INDEX ON vactst(wrap_do_analyze(i));
|
CREATE INDEX ON vaccluster(wrap_do_analyze(i));
|
||||||
INSERT INTO vactst VALUES (1), (2);
|
INSERT INTO vaccluster VALUES (1), (2);
|
||||||
ANALYZE vactst;
|
ANALYZE vaccluster;
|
||||||
ERROR: ANALYZE cannot be executed from VACUUM or ANALYZE
|
ERROR: ANALYZE cannot be executed from VACUUM or ANALYZE
|
||||||
CONTEXT: SQL function "do_analyze" statement 1
|
CONTEXT: SQL function "do_analyze" statement 1
|
||||||
SQL function "wrap_do_analyze" statement 1
|
SQL function "wrap_do_analyze" statement 1
|
||||||
@ -76,9 +76,9 @@ VACUUM FULL pg_am;
|
|||||||
VACUUM FULL pg_class;
|
VACUUM FULL pg_class;
|
||||||
VACUUM FULL pg_database;
|
VACUUM FULL pg_database;
|
||||||
VACUUM FULL vaccluster;
|
VACUUM FULL vaccluster;
|
||||||
VACUUM FULL vactst;
|
|
||||||
ERROR: ANALYZE cannot be executed from VACUUM or ANALYZE
|
ERROR: ANALYZE cannot be executed from VACUUM or ANALYZE
|
||||||
CONTEXT: SQL function "do_analyze" statement 1
|
CONTEXT: SQL function "do_analyze" statement 1
|
||||||
SQL function "wrap_do_analyze" statement 1
|
SQL function "wrap_do_analyze" statement 1
|
||||||
|
VACUUM FULL vactst;
|
||||||
DROP TABLE vaccluster;
|
DROP TABLE vaccluster;
|
||||||
DROP TABLE vactst;
|
DROP TABLE vactst;
|
||||||
|
@ -50,9 +50,9 @@ CREATE FUNCTION do_analyze() RETURNS VOID VOLATILE LANGUAGE SQL
|
|||||||
AS 'ANALYZE pg_am';
|
AS 'ANALYZE pg_am';
|
||||||
CREATE FUNCTION wrap_do_analyze(c INT) RETURNS INT IMMUTABLE LANGUAGE SQL
|
CREATE FUNCTION wrap_do_analyze(c INT) RETURNS INT IMMUTABLE LANGUAGE SQL
|
||||||
AS 'SELECT $1 FROM do_analyze()';
|
AS 'SELECT $1 FROM do_analyze()';
|
||||||
CREATE INDEX ON vactst(wrap_do_analyze(i));
|
CREATE INDEX ON vaccluster(wrap_do_analyze(i));
|
||||||
INSERT INTO vactst VALUES (1), (2);
|
INSERT INTO vaccluster VALUES (1), (2);
|
||||||
ANALYZE vactst;
|
ANALYZE vaccluster;
|
||||||
|
|
||||||
VACUUM FULL pg_am;
|
VACUUM FULL pg_am;
|
||||||
VACUUM FULL pg_class;
|
VACUUM FULL pg_class;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user