Re: Bad plan when join on function

От: Kevin Grittner
Тема: Re: Bad plan when join on function
Дата: ,
Msg-id: 4D34576C02000025000396CB@gw.wicourts.gov
(см: обсуждение, исходный текст)
Ответ на: Bad plan when join on function  (Zotov)
Ответы: Re: Bad plan when join on function  (Pavel Stehule)
Список: pgsql-performance

Скрыть дерево обсуждения

Bad plan when join on function  (Zotov, )
 Re: Bad plan when join on function  (Pavel Stehule, )
 Re: Bad plan when join on function  ("Kevin Grittner", )
  Re: Bad plan when join on function  (Pavel Stehule, )
   Re: Bad plan when join on function  (Tom Lane, )
    Re: Bad plan when join on function  (Pavel Stehule, )
 Re: Bad plan when join on function  (Shaun Thomas, )

Zotov  wrote:

> select c.id from OneRow c join abstract a on a.id=AsInteger(c.id)

> Why SeqScan???

Because you don't have an index on AsInteger(c.id).

If your function is IMMUTABLE (each possible combination of input
values always yields the same result), and you declare it such, then
you can index on the function, and it will perform at a speed similar
to the other example.

-Kevin


В списке pgsql-performance по дате сообщения:

От: Fernando Hevia
Дата:
Сообщение: Re: Problem with query
От: Achilleas Mantzios
Дата:
Сообщение: Re: "NOT IN" substantially slower in 9.0.2 than 8.3.13 - NOT EXISTS runs fast in both 8.3.13 and 9.0.2