Re: unnecessary executor overheads around seqscans

From: Andres Freund <andres(at)anarazel(dot)de>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Subject: Re: unnecessary executor overheads around seqscans
Date: 2026-01-26 18:08:45
Message-ID: ia64rgzcqwtmmgimovwiaj7qbzk3s2hvwto2i3obcv7u6sjhue@a5zvxu7y7e57
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2026-01-26 16:47:31 +0900, Amit Langote wrote:
> I tried my patch over your committed SeqNext inlining patch and ran
> the following benchmark but didn't notice in material difference:
>
> CREATE TABLE t (a int);
> INSERT INTO t SELECT generate_series(1, 1000000);
> ANALYZE t;

Because the table isn't frozen, visibility checks will probably add enough
per-row overhead to make any per-row micro-optimization harder to see. On my
somewhat older workstation freezing is a 17% improvement.

> SET max_parallel_workers_per_gather = 0;
> SELECT * FROM t WHERE a = -1;
>
> Perhaps not too surprising given it's just eliminating a couple of
> instructions per row that the branch predictor probably handles well
> anyway? Still seems worth having for code hygiene if nothing else.
>
> Same result (no diff in perf) when I apply it over your patch to move
> the scandesc == NULL check.

FWIW, on my cascade lake workstation it's a, surprisingly large, 3.5%, after
freezing. Without freezing there maybe still is a difference, but it's very
close to the noise floor.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2026-01-26 18:14:55 Re: [BUG] [PATCH] pg_basebackup produces wrong incremental files after relation truncation in segmented tables
Previous Message Jelte Fennema-Nio 2026-01-26 17:46:28 Re: meson: Make test output much more useful on failure (both in CI and locally)