Re: IN vs EXISTS equivalence

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: IN vs EXISTS equivalence
Дата
Msg-id 489C817C.EE98.0025.0@wicourts.gov
обсуждение исходный текст
Ответ на Re: IN vs EXISTS equivalence  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: IN vs EXISTS equivalence  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
>>> Tom Lane <tgl@sss.pgh.pa.us> wrote:

> I believe that the optimizable cases for EXISTS are those where the
> EXISTS() is either at the top level of WHERE, or just underneath a
NOT,

The rest of the plan makes sense to me, but this part seems narrow.
There's probably a good reason for that which is beyond my depth, but
attached is a view that is used for calculating statistics for a
database which is primarily used for "case management" purposes.  If
EXISTS could also be optimized in the contexts used there, it would be
great.

For context, this view references three other non-trivial views
(MatterHistSearch, MatterHistStage, & MatterHistStatus), and does
perform acceptably, so it's not a matter of complaining if it can't
work here, just providing a real-world example of other useful
contexts for EXISTS which might be worth covering if possible.

This view is used in a large number of queries, mostly either
selecting a single date with other selection criteria or counting rows
which match a set of matterNo values selected on complex criteria.

By the way, this view was totally unusable under 8.2.  Showing how it
worked under 8.3 was all it took to get them to expedite the upgrade.
These views, possible because of improvements in 8.3, saved "countless
programmer days" (to quote one of the programmers).

-Kevin

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Replay attack of query cancel
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: autovacuum and TOAST tables