Re: Index Searches higher than expected for skip scan

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: Index Searches higher than expected for skip scan
Дата
Msg-id CAH2-Wz=x9RTnDJUeN7yq1TftnH00L5jGtAtnB6L6i87b8Yy1fA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Index Searches higher than expected for skip scan  (Michael Christofides <michael@pgmustard.com>)
Список pgsql-performance
On Fri, Nov 7, 2025 at 6:16 AM Michael Christofides
<michael@pgmustard.com> wrote:
> Thank you for the incredibly helpful (and fast) replies Peter.

You're welcome.

> Nice idea. Once it sunk in, I realised I could try the explicit "AND boolean_field IN (true, false)" and got it down
to2 index searches: 
>
> EXPLAIN (ANALYZE, BUFFERS, VERBOSE, SETTINGS)
> SELECT boolean_field FROM example WHERE integer_field = 5432 AND boolean_field IN (true, false);

That's using the Postgres 17 work. You could also write the query as
"SELECT boolean_field FROM example WHERE integer_field = 5432 AND
boolean_field BETWEEN false AND true" and get 2 index searches. That
variant uses what I've called "range skip scan", which is new in
Postgres 18.

--
Peter Geoghegan



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