pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomasz Myrta <jasiek@klaster.net>
To: alvarezp@alvarezp.ods.org
Cc: Lista dyskusyjna pgsql-sql <pgsql-sql@postgresql.org>
Subject: [Fwd: Re: [PERFORM] Seq scan on zero-parameters function]
Date: Fri, 06 Feb 2004 08:28:39 +0100
Message-ID: <40234227.7060209@klaster.net> (raw)

Dnia 2004-02-06 08:19, Użytkownik Octavio Alvarez napisał:
> 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.
Nope.

What would you say about function without params returning timeofday()?
Is it constant?

If you are sure, that your function returns constant value - declare it
as IMMUTABLE. (look at CREATE FUNCTION documentation)

Regards,
Tomasz Myrta





view thread (7+ messages)  latest in thread

Message-ID: <40234227.7060209@klaster.net>
Permalink:  ../40234227.7060209@klaster.net/
Also on:    postgresql.org/message-id/40234227.7060209@klaster.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jasiek@klaster.net, alvarezp@alvarezp.ods.org
  Subject: Re: [Fwd: Re: [PERFORM] Seq scan on zero-parameters function]
  In-Reply-To: <40234227.7060209@klaster.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox