Re: Improve heapgetpage() performance, overhead from serializable

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Improve heapgetpage() performance, overhead from serializable
Дата
Msg-id 20230717145832.nwae6uvqxretozqj@awork3.anarazel.de
обсуждение исходный текст
Ответ на Re: Improve heapgetpage() performance, overhead from serializable  (Zhang Mingli <zmlpostgres@gmail.com>)
Ответы Re: Improve heapgetpage() performance, overhead from serializable  (John Naylor <john.naylor@enterprisedb.com>)
Список 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 по дате отправления:

Предыдущее
От: Garrett Thornburg
Дата:
Сообщение: Looking for context around which event triggers are permitted
Следующее
От: Aleksander Alekseev
Дата:
Сообщение: Re: Looking for context around which event triggers are permitted