From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | alvarezp(at)alvarezp(dot)ods(dot)org, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Seq scan on zero-parameters function |
Date: | 2004-02-06 08:50:50 |
Message-ID: | 200402060850.50818.dev@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Tomasz Myrta | 2004-02-06 08:55:26 | Re: [PERFORM] Seq scan on zero-parameters function |
Previous Message | Octavio Alvarez | 2004-02-06 08:43:12 | Re: Seq scan on zero-parameters function |
From | Date | Subject | |
---|---|---|---|
Next Message | Tomasz Myrta | 2004-02-06 08:55:26 | Re: [PERFORM] Seq scan on zero-parameters function |
Previous Message | Octavio Alvarez | 2004-02-06 08:43:12 | Re: Seq scan on zero-parameters function |