Re: Performance of subselects

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Performance of subselects
Дата
Msg-id 28910.1236355327@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Performance of subselects  (Christian Schröder <cs@deriva.de>)
Ответы Re: Performance of subselects  (Christian Schröder <cs@deriva.de>)
Список pgsql-general
=?ISO-8859-1?Q?Christian_Schr=F6der?= <cs@deriva.de> writes:
> if I want to find all records from a table that don't have a matching
> record in another table there are at least two ways to do it: Using a
> left outer join or using a subselect. I always thought that the planner
> would create identical plans for both approaches, but actually they are
> quite different which leads to a bad performance in one case.

No, they're not the same; NOT IN has different semantics for nulls.

> Another interesting thing: If table "a" contains only 400,000 rows
> (instead of 500,000) the query planner decides to use a hashed subplan
> and performance is fine again:

You're probably at the threshold where it doesn't think the hashtable
would fit in work_mem.

            regards, tom lane

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

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: Installing a module for PostgreSQL
Следующее
От: Tom Lane
Дата:
Сообщение: Re: After Upgrade from 8.2.6 to 8.3.6: function to_timestamp does not exist