Re: Mysterious performance of query because of plsql function in where condition

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Mysterious performance of query because of plsql function in where condition
Дата
Msg-id 20040702130710.GA25007@wolff.to
обсуждение исходный текст
Ответ на Mysterious performance of query because of plsql function in where condition  ("Peter Alberer" <h9351252@obelix.wu-wien.ac.at>)
Список pgsql-performance
On Fri, Jul 02, 2004 at 09:48:48 +0200,
  Peter Alberer <h9351252@obelix.wu-wien.ac.at> wrote:
>
> Postgres seems to execute the function "submission_status" for every row
> of
> the submissions table (~1500 rows). The query therefore takes quite a
> lot
> time, although in fact no row is returned from the assignments table
> when
> the condition package_id=949589 is used.

If submission_status is invertable you might want to create the
inverse function, mark it immutable and call it with 'closed'.
That would allow the optimizer to compare submissions.submission_id
to a constant.

Another option would be be to create an index on
submission_status(submissions.submission_id).

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

Предыдущее
От: Jeff
Дата:
Сообщение: Re: Mysterious performance of query because of plsql function in where condition
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: BUG #1186: Broken Index?