Re: Improve heapgetpage() performance, overhead from serializable

From: Andres Freund <andres(at)anarazel(dot)de>
To: Zhang Mingli <zmlpostgres(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: Improve heapgetpage() performance, overhead from serializable
Date: 2023-07-17 14:58:32
Message-ID: 20230717145832.nwae6uvqxretozqj@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2023-07-17 15:26:32 Re: Looking for context around which event triggers are permitted
Previous Message Garrett Thornburg 2023-07-17 14:56:36 Looking for context around which event triggers are permitted