Skip to content

Commit 3228755

Browse files
committed
Use BUFFER_USAGE_LIMIT to reduce needed test table size
Using the minimum BUFFER_USAGE_LIMIT value, we can make one of the pg_stat_io test tables smaller while still causing reuses. Author: Melanie Plageman <melanieplageman@gmail.com> Discussion: https://postgr.es/m/CAAKRu_acc6iL4M3hvOTeztf_ZPpsB3Pqio5aVHgZ5q=Pi3BZKg@mail.gmail.com
1 parent b9a7a82 commit 3228755

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/test/regress/expected/stats.out

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,11 +1396,13 @@ SET wal_skip_threshold = '1 kB';
13961396
SELECT sum(reuses) AS reuses, sum(reads) AS reads
13971397
FROM pg_stat_io WHERE context = 'vacuum' \gset io_sum_vac_strategy_before_
13981398
CREATE TABLE test_io_vac_strategy(a int, b int) WITH (autovacuum_enabled = 'false');
1399-
INSERT INTO test_io_vac_strategy SELECT i, i from generate_series(1, 8000)i;
1399+
INSERT INTO test_io_vac_strategy SELECT i, i from generate_series(1, 4500)i;
14001400
-- Ensure that the next VACUUM will need to perform IO by rewriting the table
14011401
-- first with VACUUM (FULL).
14021402
VACUUM (FULL) test_io_vac_strategy;
1403-
VACUUM (PARALLEL 0) test_io_vac_strategy;
1403+
-- Use the minimum BUFFER_USAGE_LIMIT to cause reuses with the smallest table
1404+
-- possible.
1405+
VACUUM (PARALLEL 0, BUFFER_USAGE_LIMIT 128) test_io_vac_strategy;
14041406
SELECT pg_stat_force_next_flush();
14051407
pg_stat_force_next_flush
14061408
--------------------------

src/test/regress/sql/stats.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,11 +690,13 @@ SET wal_skip_threshold = '1 kB';
690690
SELECT sum(reuses) AS reuses, sum(reads) AS reads
691691
FROM pg_stat_io WHERE context = 'vacuum' \gset io_sum_vac_strategy_before_
692692
CREATE TABLE test_io_vac_strategy(a int, b int) WITH (autovacuum_enabled = 'false');
693-
INSERT INTO test_io_vac_strategy SELECT i, i from generate_series(1, 8000)i;
693+
INSERT INTO test_io_vac_strategy SELECT i, i from generate_series(1, 4500)i;
694694
-- Ensure that the next VACUUM will need to perform IO by rewriting the table
695695
-- first with VACUUM (FULL).
696696
VACUUM (FULL) test_io_vac_strategy;
697-
VACUUM (PARALLEL 0) test_io_vac_strategy;
697+
-- Use the minimum BUFFER_USAGE_LIMIT to cause reuses with the smallest table
698+
-- possible.
699+
VACUUM (PARALLEL 0, BUFFER_USAGE_LIMIT 128) test_io_vac_strategy;
698700
SELECT pg_stat_force_next_flush();
699701
SELECT sum(reuses) AS reuses, sum(reads) AS reads
700702
FROM pg_stat_io WHERE context = 'vacuum' \gset io_sum_vac_strategy_after_

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy