Skip site navigation (1) Skip section navigation (2)

Re: function not called if part of aggregate

From: Greg Stark <gsstark(at)mit(dot)edu>
To: "Craig A(dot) James" <cjames(at)modgraph-usa(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: function not called if part of aggregate
Date: 2006-06-11 18:00:38
Message-ID: 87ac8jfu7t.fsf@stark.xeocode.com (view raw or flat)
Thread:
Lists: pgsql-performance
"Craig A. James" <cjames(at)modgraph-usa(dot)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


In response to

Responses

pgsql-performance by date

Next:From: Mario SplivaloDate: 2006-06-11 21:42:20
Subject: Re: scaling up postgres
Previous:From: Jim C. NasbyDate: 2006-06-11 17:48:37
Subject: Re: function not called if part of aggregate

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group