Re: Special-case executor expression steps for common combinations

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Andreas Karlsson <andreas(at)proxel(dot)se>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Special-case executor expression steps for common combinations
Date: 2024-07-04 16:26:18
Message-ID: A48C4DBC-C6BF-4850-B9CB-D0AC27FB8C3B@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 20 Jun 2024, at 17:22, Andreas Karlsson <andreas(at)proxel(dot)se> wrote:
>
> On 10/12/23 11:48 AM, Daniel Gustafsson wrote:
>> Thoughts?
>
> I have looked at the patch and it still applies, builds and passes the test cases and I personally think these optimizations are pretty much no-brainers that we should do and it is a pity nobody has had the time to review this patch.
>
> 1) The no-return case should help with the JIT, making jitted code faster.
>
> 2) The specialized strict steps helps with many common queries in the interpreted mode.
>
> The code itself looks really good (great work!) but I have two comments on it.

Thanks for review!

> 1) I think the patch should be split into two. The two different optimizations are not related at all other than that they create specialized versions of expressions steps. Having them as separate makes the commit history easier to read for future developers.

That's a good point, the attached v2 splits it into two separate commits.

> 2) We could generate functions which return void rather than NULL and therefore not have to do a return at all but I am not sure that small optimization and extra clarity would be worth the hassle. The current approach with adding Assert() is ok with me. Daniel, what do you think?

I'm not sure that would move the needle enough to warrant the extra complexity.
It could be worth pursuing, but it can be done separately from this.

--
Daniel Gustafsson

Attachment Content-Type Size
v2-0002-Add-special-case-fast-paths-for-strict-functions.patch application/octet-stream 8.6 KB
v2-0001-Replace-EEOP_DONE-with-special-steps-for-return-n.patch application/octet-stream 11.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2024-07-04 16:26:33 refactor the CopyOneRowTo
Previous Message Tom Lane 2024-07-04 16:01:55 Re: Grammar guidelines in Postgres