Re: where (x,y,z) in ((x1,y1, z1), (x1,y1, z1), (x1,y1, z1), (x2,y2, z2)) (not) optimized - Mailing list pgsql-general

From Tom Lane
Subject Re: where (x,y,z) in ((x1,y1, z1), (x1,y1, z1), (x1,y1, z1), (x2,y2, z2)) (not) optimized
Date
Msg-id 10677.1232984194@sss.pgh.pa.us
Whole thread Raw
In response to where (x,y,z) in ((x1,y1, z1), (x1,y1, z1), (x1,y1, z1), (x2,y2, z2)) (not) optimized  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
List pgsql-general
=?UTF-8?Q?Grzegorz_Ja=C5=9Bkiewicz?= <gryzman@gmail.com> writes:
> why :
> select * from foo where X in (1,1,1,1,1,1,1,1) --- same values in search.
> never gets optimized by planner, etc ?

We actually did that, before 8.0 or thereabouts.  It was removed because
it cost a lot of planner cycles for *every* query, and helped for only
a small number of stupidly-written ones.

In general, you can probably remove such duplicates on the client side
more efficiently than the database could anyway (realizing that whatever
it might do has to be datatype-independent).

            regards, tom lane

pgsql-general by date:

Previous
From: Matthias Karlsson
Date:
Subject: Re: How to do an UPDATE for all the fields that do NOT break a constraint?
Next
From: Asko Oja
Date:
Subject: Re: dblink syntax question for remotely invoking void-returning procedures