Re: Seq scan on zero-parameters function

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Seq scan on zero-parameters function
Дата
Msg-id 200402060850.50818.dev@archonet.com
обсуждение исходный текст
Ответ на Seq scan on zero-parameters function  ("Octavio Alvarez" <alvarezp@alvarezp.ods.org>)
Ответы Re: Seq scan on zero-parameters function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-performance
On Friday 06 February 2004 07:19, Octavio Alvarez wrote:
> Hi!
>
>    I'd like to know if this is expected behavior. These are two couples of
> queries. In each couple, the first one has a WHERE field = function()
> condition, just like the second one, but in the form WHERE field =
> (SELECT function()). In my opinion, both should have the same execution
> plan, as the function has no parameters and, therefore, is constant.

Not necessarily constant - think about random() or timeofday().
Have you set the attributes on your function?

http://www.postgresql.org/docs/7.4/static/sql-createfunction.html

> pgdb=# explain analyze select count(*) from t_students where period =
> (select current_period_id());

It's not entirely clear to me why this form is different from the other form
though.

--
  Richard Huxton
  Archonet Ltd

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

Предыдущее
От: "Octavio Alvarez"
Дата:
Сообщение: Re: Seq scan on zero-parameters function
Следующее
От: "Bruno BAGUETTE"
Дата:
Сообщение: Increase performance of a UNION query that thakes 655.07 msec to be runned ?