Re: Bug in nbtree optimization to skip > operator comparisons (or < comparisons in backwards scans)

Поиск
Список
Период
Сортировка
От Pavel Borisov
Тема Re: Bug in nbtree optimization to skip > operator comparisons (or < comparisons in backwards scans)
Дата
Msg-id CALT9ZEFRXvd9L5qbqYkBEBvJi=CYXpNPt0Bcs5eKgw06=fM17w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Bug in nbtree optimization to skip > operator comparisons (or < comparisons in backwards scans)  ("Anton A. Melnikov" <a.melnikov@postgrespro.ru>)
Ответы Re: Bug in nbtree optimization to skip > operator comparisons (or < comparisons in backwards scans)  ("Anton A. Melnikov" <a.melnikov@postgrespro.ru>)
Список pgsql-hackers
Hi, Anton!
Looks like an oversight when refactoring BTScanOpaqueData.firstPage into using function argument in 06b10f80ba4.

@@ -2487,14 +2486,13 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
104
105     /* remember which buffer we have pinned */
106     so->currPos.buf = buf;
107 -   so->firstPage = true;
108
109     _bt_initialize_more_data(so, dir);
110
111     /*
112      * Now load data from the first page of the scan.
113      */
114 -   if (!_bt_readpage(scan, dir, start))
115 +   if (!_bt_readpage(scan, dir, start, false))

Attached is a fix.
Thank you!

Regards,
Pavel


On Fri, 22 Mar 2024 at 11:29, Anton A. Melnikov <a.melnikov@postgrespro.ru> wrote:
Hi!

Maybe _bt_readpage(scan, dir, start, true) needed at this line:

https://github.com/postgres/postgres/blob/b4080fa3dcf6c6359e542169e0e81a0662c53ba8/src/backend/access/nbtree/nbtsearch.c#L2501

?

Do we really need to try prechecking the continuescan flag here?

And the current "false" in the last arg does not match the previous code before 06b10f80ba
and the current comment above.

Would be very grateful for clarification.

With the best regards!

--
Anton A. Melnikov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Anton A. Melnikov"
Дата:
Сообщение: Re: Bug in nbtree optimization to skip > operator comparisons (or < comparisons in backwards scans)
Следующее
От: "Anton A. Melnikov"
Дата:
Сообщение: Re: Bug in nbtree optimization to skip > operator comparisons (or < comparisons in backwards scans)