From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joe <dev@freedomcircle.net>
Cc: Alvaro Herrera <alvherre@commandprompt.com>
Cc: George Pavlov <gpavlov@mynewplace.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: huge disparities in =/IN/BETWEEN performance
Date: Fri, 09 Feb 2007 09:26:52 -0500
Message-ID: <24132.1171031212@sss.pgh.pa.us> (raw)
In-Reply-To: <1170997319.697.72.camel@pampa>
References: <8C5B026B51B6854CBE88121DBF097A86815F42@ehost010-33.exch010.intermedia.net>
<7377.1170986068@sss.pgh.pa.us>
<8C5B026B51B6854CBE88121DBF097A86815F81@ehost010-33.exch010.intermedia.net>
<20070209021414.GU24069@alvh.no-ip.org>
<14273.1170993005@sss.pgh.pa.us>
<1170994335.697.55.camel@pampa>
<14627.1170995084@sss.pgh.pa.us>
<1170997319.697.72.camel@pampa>
Joe <dev@freedomcircle.net> writes:
> George didn't provide the inside of his view, but it's
> possible that my earlier example could be rephrased as follows:
> create view v_foo as select * from tab where x < 5;
> select * from v_foo where x = 10;
So try it:
regression=# create table tab (x int);
CREATE TABLE
regression=# create view v_foo as select * from tab where x < 5;
CREATE VIEW
regression=# explain select * from v_foo where x = 10;
QUERY PLAN
----------------------------------------------------
Seq Scan on tab (cost=0.00..46.00 rows=4 width=4)
Filter: ((x < 5) AND (x = 10))
(2 rows)
regression=# set constraint_exclusion to 1;
SET
regression=# explain select * from v_foo where x = 10;
QUERY PLAN
------------------------------------------
Result (cost=0.00..0.01 rows=1 width=0)
One-Time Filter: false
(2 rows)
(This is with HEAD, but I think 8.2 can do it too.)
regards, tom lane
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: tgl@sss.pgh.pa.us, dev@freedomcircle.net, alvherre@commandprompt.com, gpavlov@mynewplace.com
Subject: Re: huge disparities in =/IN/BETWEEN performance
In-Reply-To: <24132.1171031212@sss.pgh.pa.us>
* 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