From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Constraint exclusion on UNION ALL subqueries with WHERE conditions |
Date: | 2011-09-19 03:59:30 |
Message-ID: | 25440.1316404770@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-performance |
=?ISO-8859-1?Q?Gunnlaugur_=DE=F3r_Briem?= <gunnlaugur(at)gmail(dot)com> writes:
> I did this:
> CREATE VIEW unionview AS
> SELECT col, otherstuff FROM (heavy subquery)
> WHERE col BETWEEN 1 AND 3
> UNION ALL
> SELECT col, otherstuff FROM (another heavy subquery)
> WHERE col BETWEEN 4 AND 6;
> hoping that the planner could use the WHERE conditions (like it would use check constraints on tables) to exclude one of the subqueries, for a query like:
> SELECT * FROM unionview WHERE col=2;
> But it doesn't. (In PostgreSQL 8.4.5, at least.)
Works for me in 8.4.8. Do you have constraint_exclusion set to ON?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2011-09-19 04:06:11 | Re: pg_upgrade automatic testing |
Previous Message | Robert Haas | 2011-09-19 00:11:26 | Re: unite recovery.conf and postgresql.conf |
From | Date | Subject | |
---|---|---|---|
Next Message | Vitalii Tymchyshyn | 2011-09-19 09:37:29 | Re: PostgreSQL-related topics of theses and seminary works sought (Was: Hash index use presently(?) discouraged...) |
Previous Message | Jeff Janes | 2011-09-19 02:58:02 | Re: How to make hash indexes fast |