Re: distinct estimate of a hard-coded VALUES list - Mailing list pgsql-hackers

From Tom Lane
Subject Re: distinct estimate of a hard-coded VALUES list
Date
Msg-id 28817.1471897475@sss.pgh.pa.us
Whole thread Raw
In response to Re: distinct estimate of a hard-coded VALUES list  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Sat, Aug 20, 2016 at 4:58 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I am not exactly sold on this assumption that applications have
>> de-duplicated the contents of a VALUES or IN list.  They haven't been
>> asked to do that in the past, so why do you think they are doing it?

> It's hard to know, but my intuition is that most people would
> deduplicate.  I mean, nobody is going to want to their query generator
> to send X IN (1, 1, <repeat a zillion more times>) to the server if it
> could have just sent X IN (1).

I dunno, these are the very same people who send "WHERE 1=1" so that
they can save one line of code to decide whether to append AND or not
before the first real condition.

Still, maybe we should optimize for smart queries rather than stupid
ones.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Bug in abbreviated keys abort handling (found with amcheck)
Next
From: Tom Lane
Date:
Subject: Re: New SQL counter statistics view (pg_stat_sql)