From: Alvaro Herrera <alvherre@commandprompt.com>
To: George Pavlov <gpavlov@mynewplace.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: huge disparities in =/IN/BETWEEN performance
Date: Thu, 8 Feb 2007 23:14:14 -0300
Message-ID: <20070209021414.GU24069@alvh.no-ip.org> (raw)
In-Reply-To: <8C5B026B51B6854CBE88121DBF097A86815F81@ehost010-33.exch010.intermedia.net>
References: <8C5B026B51B6854CBE88121DBF097A86815F42@ehost010-33.exch010.intermedia.net>
<7377.1170986068@sss.pgh.pa.us>
<8C5B026B51B6854CBE88121DBF097A86815F81@ehost010-33.exch010.intermedia.net>
George Pavlov wrote:
> the basic question i have is fairly clear though: why saying "where x =
> 10" should be different (in ANY cicumstance, not just mine) from saying
> "where x between 10 and 10" or from "where x in (select ... /* some
> query that returns 10 */)" ???
I think the principle here is that the system is not gonna waste cycles
on dumb queries. Supposedly, morphing "foo BETWEEN 10 and 10" into
"foo=10" is not a trivial transformation, and it'd impose a planning
cost on all non-dumb BETWEEN queries. That cost is best avoided: if you
optimize for dumb users, the smart users then want you buried because
you've lost performance doing useless work.
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: alvherre@commandprompt.com, gpavlov@mynewplace.com, tgl@sss.pgh.pa.us
Subject: Re: huge disparities in =/IN/BETWEEN performance
In-Reply-To: <20070209021414.GU24069@alvh.no-ip.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox