Re: Query plans not identical for `id in(1,2,3)` and `(id=1 or id=2 or id=3)`

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: Query plans not identical for `id in(1,2,3)` and `(id=1 or id=2 or id=3)`
Дата
Msg-id 6da830f74343b343b17f020b82570d2e67de8b65.camel@cybertec.at
обсуждение исходный текст
Ответ на Query plans not identical for `id in(1,2,3)` and `(id=1 or id=2 or id=3)`  (Ilya Basin <basinilya@gmail.com>)
Список pgsql-general
On Sat, 2024-03-09 at 23:08 +0400, Ilya Basin wrote:
> I have a list of bigint keys and I need to retrieve rows by these keys.
> Normally, I would split this list into pages of size 900 and perform
> several `SELECT ... WHERE key in($1,$2,...)`. However, the proprietary
> ORM we use can only produce this SQL:
> `SELECT ... WHERE (key=$1 or key=$2 or ...)`.
> Surprisingly, PostgreSQL planner treats these two SQLs differently:
>
> Is it possible to configure PostgreSQL 12.16 to treat the second query as the first?

No, that is currently not possible.

Yours,
Laurenz Albe



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

Предыдущее
От: Rob Sargent
Дата:
Сообщение: Re: Insert with Jsonb column hangs
Следующее
От: Thomas Kellerer
Дата:
Сообщение: Re: Query plans not identical for `id in(1,2,3)` and `(id=1 or id=2 or id=3)`