Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Use DELETE instead of UPDATE to speed up vacuum test
authorMelanie Plageman <melanieplageman@gmail.com>
Mon, 29 Jul 2024 19:37:26 +0000 (15:37 -0400)
committerMelanie Plageman <melanieplageman@gmail.com>
Mon, 29 Jul 2024 19:39:38 +0000 (15:39 -0400)
01e2b7f0fd02a44e introduced a test which generated dead tuples for
vacuum with an UPDATE. The test only required enough dead TIDs for two
rounds of index vacuuming. This can be accomplished with a DELETE
instead of an UPDATE -- which generates about 50% less WAL and makes the
test 20% faster in many cases. The test takes several seconds (more on
slow buildfarm animals) because we need quite a few tuples to trigger
two rounds of index vacuuming; so it is worth a follow-on commit to
speed it up.

Suggested-by: Masahiko Sawada
Discussion: https://postgr.es/m/CAAKRu_bWmMjmqL%2BOZ2duEQ80u7cRvpsExLNZNjzk-pXX5skwMQ%40mail.gmail.com
Backpatch-through: 14, the first version containing this test.

src/test/recovery/t/043_vacuum_horizon_floor.pl

index 0ad11c869f959f425081d81b69a4ffa652ba9d9e..90141d365c08bd7000f51a8b79a9c1daf5df1f07 100644 (file)
@@ -75,7 +75,7 @@ $node_primary->safe_psql($test_db, qq[
    CREATE TABLE ${table1}(col1 int) with (autovacuum_enabled=false);
    INSERT INTO $table1 SELECT generate_series(1, 200000);
    CREATE INDEX on ${table1}(col1);
-   UPDATE $table1 SET col1 = 0 WHERE col1 > 1;
+   DELETE FROM $table1 WHERE col1 > 1;
    INSERT INTO $table1 VALUES(1);
 ]);