IN or ANY for batch queries

Поиск
Список
Период
Сортировка
От Alessandro Gherardi
Тема IN or ANY for batch queries
Дата
Msg-id 1326195889.5524206.1527300602365@mail.yahoo.com
обсуждение исходный текст
Ответы Re: IN or ANY for batch queries  (Dave Cramer <pg@fastcrypt.com>)
Re: IN or ANY for batch queries  (Charles Pritchard <chuck@jumis.com>)
Re: IN or ANY for batch queries  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
Список pgsql-jdbc
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 по дате отправления:

Предыдущее
От: Dave Cramer
Дата:
Сообщение: [pgjdbc/pgjdbc] 1f5e82: fixed spelling mistake in PostgreSQL
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: IN or ANY for batch queries