Re: BUG #1435: Optimizer not using index on large tables when inner joining two views

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #1435: Optimizer not using index on large tables when inner joining two views
Дата
Msg-id 25577.1106605263@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #1435: Optimizer not using index on large tables when inner joining two views  ("Yary Hluchan" <not.com@gmail.com>)
Список pgsql-bugs
"Yary Hluchan" <not.com@gmail.com> writes:
> My reading of it is that the optimizer isn't applying a distributive rule:
> condition(a union b) == condition(a) union condition(b).

No, the correct reading is that a UNION subquery is planned
independently of the surrounding query.  This is not likely to change
soon, as it would involve some rather wholesale changes.

My advice is to lose the open/closed distinction and fold those tables
into single tables with an extra boolean flag column.  I suppose the
point of this database layout is to provide fast access to the "open"
subsets, but you could probably achieve that by making partial indexes,
eg

    create index vote_open_ids on vote (id) where is_open;

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #1433: domain check constraint not checked when adding new column
Следующее
От: Martin Pitt
Дата:
Сообщение: Insecure temporary file usage in developer/build tools