Re: Constraint exclusion on UNION ALL subqueries with WHERE conditions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Constraint exclusion on UNION ALL subqueries with WHERE conditions
Дата
Msg-id 25440.1316404770@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Constraint exclusion on UNION ALL subqueries with WHERE conditions  (Gunnlaugur Þór Briem <gunnlaugur@gmail.com>)
Ответы Re: Constraint exclusion on UNION ALL subqueries with WHERE conditions  (Gunnlaugur Þór Briem <gunnlaugur@gmail.com>)
Список pgsql-performance
=?ISO-8859-1?Q?Gunnlaugur_=DE=F3r_Briem?= <gunnlaugur@gmail.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
ofthe 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

В списке pgsql-performance по дате отправления:

Предыдущее
От: Jeff Janes
Дата:
Сообщение: Re: How to make hash indexes fast
Следующее
От: Vitalii Tymchyshyn
Дата:
Сообщение: Re: PostgreSQL-related topics of theses and seminary works sought (Was: Hash index use presently(?) discouraged...)