pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Stark <gsstark@mit.edu>
To: Craig A. James <cjames@modgraph-usa.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: function not called if part of aggregate
Date: 11 Jun 2006 14:00:38 -0400
Message-ID: <87ac8jfu7t.fsf@stark.xeocode.com> (raw)
In-Reply-To: <448C505C.2080504@modgraph-usa.com>
References: <448C505C.2080504@modgraph-usa.com>


"Craig A. James" <cjames@modgraph-usa.com> writes:

> This doesn't seem right to me -- how can the optimizer possibly know that a
> function doesn't have a side effect, as in my case? Functions could do all
> sorts of things, such as logging activity, filling in other tables, etc, etc.

The optimizer can know this if the user tells it so by marking the function
IMMUTABLE. If the function is marked VOLATILE then the optimizer can know it
might have side effects.

However that's not enough to explain what you've shown. How about you show the
actual query and actual plan you're working with? The plan you've shown can't
result from the query you sent.

-- 
greg




view thread (7+ messages)  latest in thread

Message-ID: <87ac8jfu7t.fsf@stark.xeocode.com>
Permalink:  ../87ac8jfu7t.fsf@stark.xeocode.com/
Also on:    postgresql.org/message-id/87ac8jfu7t.fsf@stark.xeocode.com

 · 

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-performance@postgresql.org
  Cc: gsstark@mit.edu, cjames@modgraph-usa.com
  Subject: Re: function not called if part of aggregate
  In-Reply-To: <87ac8jfu7t.fsf@stark.xeocode.com>

* 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