Re: Binary search in ScalarArrayOpExpr for OR'd constant arrays

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Binary search in ScalarArrayOpExpr for OR'd constant arrays
Дата
Msg-id CAApHDvq_G0dn-tfX-sPCwOdxoXUUL19XSxh0OsgYPn4n97YzOg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Binary search in ScalarArrayOpExpr for OR'd constant arrays  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Список pgsql-hackers
On Sun, 11 Apr 2021 at 10:38, Tomas Vondra
<tomas.vondra@enterprisedb.com> wrote:
> I wonder what's the relationship between the length of the IN list and
> the minimum number of rows needed for the hash to start winning.

I made the attached spreadsheet which demonstrates the crossover point
using the costs that I coded into cost_qual_eval_walker().

It basically shows, for large arrays, that there are fairly
significant benefits to hashing for just 2 lookups and not hashing
only just wins for 1 lookup.  However, the cost model does not account
for allocating memory for the hash table, which is far from free.

You can adjust the number of items in the IN clause by changing the
value in cell B1. The values in B2 and B3 are what I saw the planner
set when I tested with both INT and TEXT types.

David

Вложения

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Have I found an interval arithmetic bug?
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Teaching users how they can get the most out of HOT in Postgres 14