Re: How bad is using queries with thousands of values for operators IN or ANY?

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Thorsten Schöning <tschoening(at)am-soft(dot)de>, pgsql-general(at)postgresql(dot)org
Subject: Re: How bad is using queries with thousands of values for operators IN or ANY?
Date: 2020-08-31 08:23:54
Message-ID: 5a4a0546943a94ed34392f2cbbb7b213a061d539.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 2020-08-31 at 10:04 +0200, Thorsten Schöning wrote:
> I have lots of queries in which I need to restrict access to rows
> using some decimal row-ID and am mostly doing so with using the
> operator IN in WHERE-clauses. Additionally I'm mostly embedding the
> IDs as ","-seperated list into the query directly, e.g. because I
> already hit a limitation of ~32k parameters of the JDBC-driver[1] for
> Postgres.

Is it an option to change that usage pattern?

Very often this is some kind of "poor man's join": first select all
rows from table A that match a certain condition, then select all
rows from B where the foreign key matches any IDs from the first query.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2020-08-31 08:51:50 Re: How bad is using queries with thousands of values for operators IN or ANY?
Previous Message Tim Cross 2020-08-31 08:21:00 Re: How bad is using queries with thousands of values for operators IN or ANY?