From b7803f8df7e7c7ff1390f33ec57a890dc861d91f Mon Sep 17 00:00:00 2001 From: Bojan Serafimov Date: Mon, 30 Jan 2023 16:24:51 -0500 Subject: [PATCH] Test prefetch miss --- test_runner/performance/test_seqscans.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/test_runner/performance/test_seqscans.py b/test_runner/performance/test_seqscans.py index bd84724405..013c9954e7 100644 --- a/test_runner/performance/test_seqscans.py +++ b/test_runner/performance/test_seqscans.py @@ -35,11 +35,17 @@ from pytest_lazyfixture import lazy_fixture # type: ignore ], ) def test_seqscans(env: PgCompare, scale: int, rows: int, iters: int, workers: int): - rows = scale * rows + rows = scale * rows * 10 with closing(env.pg.connect(options="-cstatement_timeout=0")) as conn: with conn.cursor() as cur: + cur.execute("set enable_seqscan_prefetch=on") + cur.execute("set max_parallel_workers_per_gather=0") + cur.execute("drop table if exists t;") + + + cur.execute("create table t (i integer);") cur.execute(f"insert into t values (generate_series(1,{rows}));") @@ -62,4 +68,11 @@ def test_seqscans(env: PgCompare, scale: int, rows: int, iters: int, workers: in with env.record_duration("run"): for i in range(iters): - cur.execute("select count(*) from t;") + cur.execute("explain (analyze, prefetch) select count(*) from t;") + result = cur.fetchall() + prefetch_stats = result[1][0] + + import re + regex = re.compile(r'([\S]+)=(\S+)') + parsed = dict(regex.findall(prefetch_stats)) + print("FFFF", parsed)