Re: IN or ANY for batch queries

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Re: IN or ANY for batch queries
Дата
Msg-id CADK3HHKS8tUaHh+QWrW0DP280NzDcLVPz_1N1VmY4+cveXYG=Q@mail.gmail.com
обсуждение исходный текст
Ответ на IN or ANY for batch queries  (Alessandro Gherardi <alessandro.gherardi@yahoo.com>)
Список pgsql-jdbc
Well we aren't going to cache the array so probably not.


On 25 May 2018 at 22:10, Alessandro Gherardi <alessandro.gherardi@yahoo.com> wrote:
Hi,
I'd like to understand if there are any benefits to using SELECT ... WHERE primary_key = ANY(large array of values) as opposed to SELECT ... WHERE primary_key IN(?,?,...) via JDBC.

I'm aware that to use ANY(array), I first have to call array = connection.createArrayOf(Java array), then preparedStatement.setArray(X, array).

I ran a few tests and the latency seems to be pretty much the same. However, since in my application the number of values in the array can vary, I'm wondering if using ANY has the benefit of causing the driver/DB to cache a smaller number of prepared statement.

Any thoughts?

Thank you in advance,
Alessandro

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

Предыдущее
От: Alessandro Gherardi
Дата:
Сообщение: IN or ANY for batch queries
Следующее
От: Charles Pritchard
Дата:
Сообщение: Re: IN or ANY for batch queries