Re: Improve heapgetpage() performance, overhead from serializable - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Improve heapgetpage() performance, overhead from serializable
Date
Msg-id 20230717145832.nwae6uvqxretozqj@awork3.anarazel.de
Whole thread Raw
In response to Re: Improve heapgetpage() performance, overhead from serializable  (Zhang Mingli <zmlpostgres@gmail.com>)
Responses Re: Improve heapgetpage() performance, overhead from serializable
List pgsql-hackers
Hi,

On 2023-07-17 09:55:07 +0800, Zhang Mingli wrote:
> LGTM and I have a fool question:
>
>     if (likely(all_visible))
>     {
>         if (likely(!check_serializable))
>             scan->rs_ntuples = heapgetpage_collect(scan, snapshot, page, buffer,
>                                                    block, lines, 1, 0);
>         else
>             scan->rs_ntuples = heapgetpage_collect(scan, snapshot, page, buffer,
>                                                    block, lines, 1, 1);
>     }
>     else
>     {
>         if (likely(!check_serializable))
>             scan->rs_ntuples = heapgetpage_collect(scan, snapshot, page, buffer,
>                                                    block, lines, 0, 0);
>         else
>             scan->rs_ntuples = heapgetpage_collect(scan, snapshot, page, buffer,
>                                                    block, lines, 0, 1);
>
>
> Does it make sense to combine if else condition and put it to the incline function’s param?
>
> Like:
> scan->rs_ntuples = heapgetpage_collect(scan, snapshot, page, buffer,
>                                                    block, lines, all_visible, check_serializable);

I think that makes it less likely that the compiler actually generates a
constant-folded version for each of the branches. Perhaps worth some
experimentation.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Garrett Thornburg
Date:
Subject: Looking for context around which event triggers are permitted
Next
From: Aleksander Alekseev
Date:
Subject: Re: Looking for context around which event triggers are permitted