Re: where (x, y, z) in ((x1, y1, z1), (x1, y1, z1), (x1, y1, z1), (x2, y2, z2)) (not) optimized

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
Cc: GENERAL <pgsql-general(at)postgresql(dot)org>
Subject: Re: where (x, y, z) in ((x1, y1, z1), (x1, y1, z1), (x1, y1, z1), (x2, y2, z2)) (not) optimized
Date: 2009-01-26 15:36:34
Message-ID: 10677.1232984194@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?UTF-8?Q?Grzegorz_Ja=C5=9Bkiewicz?= <gryzman(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Asko Oja 2009-01-26 16:53:47 Re: dblink syntax question for remotely invoking void-returning procedures
Previous Message Matthias Karlsson 2009-01-26 14:45:15 Re: How to do an UPDATE for all the fields that do NOT break a constraint?