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?


> 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 

  Richard Huxton
  Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to