From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Amit Langote <amitlangote09(at)gmail(dot)com> |
Cc: | David Rowley <dgrowleyml(at)gmail(dot)com>, Vladlen Popolitov <v(dot)popolitov(at)postgrespro(dot)ru>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Junwang Zhao <zhjwpku(at)gmail(dot)com> |
Subject: | Re: Some ExecSeqScan optimizations |
Date: | 2025-07-09 23:34:21 |
Message-ID: | tqlmkwh654vwa37wv3lnefji3tm46iiub7hxkecwh6rimnrh2h@k64nn4lm4tl7 |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2025-01-22 10:07:51 +0900, Amit Langote wrote:
> On Fri, Jan 17, 2025 at 2:05 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> > Here's v5 with a few commit message tweaks.
> >
> > Barring objections, I would like to push this early next week.
>
> Pushed yesterday. Thank you all.
While looking at a profile I recently noticed that ExecSeqScanWithQual() had a
runtime branch to test whether qual is NULL, which seemed a bit silly. I think
we should use pg_assume(), which I just added to avoid a compiler warning, to
improve the code generation here.
The performance gain unsurprisingly isn't significant (but seems repeatably
measureable), but it does cut out a fair bit of unnecessary code.
andres(at)awork3:/srv/dev/build/postgres/m-dev-optimize$ size executor_nodeSeqscan.c.*o
text data bss dec hex filename
3330 0 0 3330 d02 executor_nodeSeqscan.c.assume.o
3834 0 0 3834 efa executor_nodeSeqscan.c.o
A 13% reduction in actual code size isn't bad for such a small change, imo.
I have a separate question as well - do we need to call ResetExprContext() if
we neither qual, projection nor epq? I see a small gain by avoiding that.
Greetings,
Andres Freund
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Optimize-seqscan-code-generation-using-pg_assume.patch | text/x-diff | 1.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2025-07-09 23:53:02 | Re: Remaining dependency on setlocale() |
Previous Message | Andres Freund | 2025-07-09 23:21:29 | Re: gcc 15 "array subscript 0" warning at level -O3 |