Re: Interesting Query Performance Question

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Interesting Query Performance Question
Дата
Msg-id 21222.1289063538@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Interesting Query Performance Question  (David W Noon <dwnoon@ntlworld.com>)
Список pgsql-admin
David W Noon <dwnoon@ntlworld.com> writes:
> On Sat, 06 Nov 2010 11:59:48 -0400, Tom Lane wrote about Re: [ADMIN]
>> In general, NOT IN is hard to optimize because of its weird behavior
>> for NULLs.  I'd suggest looking into converting the query to use an
>> EXISTS instead.

> I have know about that issue for some years, so I always use a column
> that has been declared NOT NULL for the sub-query.  Does PostgreSQL not
> use that property to bypass the vagaries of NULL in an IN predicate?

No.  It's a reasonable TODO item though.  Up till fairly recently, we
didn't have infrastructure that would allow building plans that depended
for correctness on the existence of a constraint.  (In particular,
I'd want such a plan to get thrown away and redone if someone dropped
the NOT NULL constraint.)  We have most of that now, although it only
works for constraints that have entries in pg_constraint, which NOT NULL
doesn't yet.  Maybe in another few months ...

            regards, tom lane

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

Предыдущее
От: David W Noon
Дата:
Сообщение: Re: Interesting Query Performance Question
Следующее
От: Viktor Bojović
Дата:
Сообщение: drop table