Re: IN or ANY for batch queries

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Alessandro Gherardi <alessandro(dot)gherardi(at)yahoo(dot)com>
Cc: pgsql-jdbc(at)lists(dot)postgresql(dot)org
Subject: Re: IN or ANY for batch queries
Date: 2018-05-27 00:34:58
Message-ID: CADK3HHKS8tUaHh+QWrW0DP280NzDcLVPz_1N1VmY4+cveXYG=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Well we aren't going to cache the array so probably not.

Dave Cramer

davec(at)postgresintl(dot)com
www.postgresintl.com

On 25 May 2018 at 22:10, Alessandro Gherardi <alessandro(dot)gherardi(at)yahoo(dot)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
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Charles Pritchard 2018-05-27 00:49:06 Re: IN or ANY for batch queries
Previous Message Alessandro Gherardi 2018-05-26 02:10:02 IN or ANY for batch queries