Re: Batching in executor

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Junwang Zhao <zhjwpku(at)gmail(dot)com>
Cc: cca5507 <cca5507(at)qq(dot)com>, Daniil Davydov <3danissimo(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tomas Vondra <tomas(at)vondra(dot)me>
Subject: Re: Batching in executor
Date: 2026-07-03 06:05:42
Message-ID: CA+HiwqESTyLOPZ2s=Th1e-EpP7esrC=9uH1mBAhoPUU8CWhiGQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jul 3, 2026 at 2:19 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> Performance (meson release builds, master vs patched, pg_prewarm'd
> table, vacuum-frozen for the all-visible rows; median ms over the
> 1M..10M row sizes, ranges across two runs):
>
> all-visible not-all-visible
> count(*) (no qual) -35% to -43% -21% to -31%
> count(*) WHERE pass-all -17% to -23% -14% to -16%
> count(*) WHERE pass-none -15% to -20% -13% to -18%
>
> The win is largest where per-tuple scan overhead dominates -- no qual,
> and all-visible pages where the visibility check is cheap -- and
> proportionally smaller as qual evaluation (unchanged by this series)
> is added. Two runs agree to within a couple of points at 5M and 10M;
> the 1-2M figures are noisier on my machine, so the larger sizes are
> the ones to trust.

Looks like I got my benchmark table mixed up: those figures were
actually from SELECT * over a full scan (forced with LIMIT 1 OFFSET
N), not count(*) as the labels say, so they included per-row
projection and overstate the improvement for a plain count(*).
Re-running with count(*), same tables, prewarmed, master vs patched:

all-visible not-all-visible
count(*) (no qual) -20% to -21% -12% to -20%
count(*) WHERE pass-all -9% -8% to -12%
count(*) WHERE pass-none -17% -14% to -20%

(5M and 10M rows, where run-to-run variance is under a couple of
percent; the 1-2M figures are noisier on my machine. The all-visible
numbers are nearly flat across sizes, hence the single values.)

--
Thanks, Amit Langote

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ewan Young 2026-07-03 06:08:24 Re: GIN amcheck leaks memory in gin_check_parent_keys_consistency
Previous Message Feng Wu 2026-07-03 06:03:06 Re: [PATCH v2] Avoid internal error for invalid interval typmods