From: Dawid Kuroczko <qnex42@gmail.com>
To: weigelt@metux.de
To: pgsql-performance@postgresql.org
Subject: Re: immutable functions vs. join for lookups ?
Date: Fri, 22 Apr 2005 12:15:24 +0200
Message-ID: <758d5e7f050422031579a04963@mail.gmail.com> (raw)
In-Reply-To: <20050421192226.GB16548@nibiru.borg.metux.de>
References: <20050415205511.GB20345@nibiru.borg.metux.de>
<6776.1113599567@sss.pgh.pa.us>
<20050417060603.GA23283@nibiru.borg.metux.de>
<c2d9e70e05041701372aee3a2c@mail.gmail.com>
<20050421192226.GB16548@nibiru.borg.metux.de>
On 4/21/05, Enrico Weigelt <weigelt@metux.de> wrote:
> <snip>
> > Even if your data never changes it *can* change so the function should
> > be at most stable not immutable.
>
> okay, the planner sees that the table could potentionally change.
> but - as the dba - I'd like to tell him, this table *never* changes
> in practise (or at most there will be an insert once a year)
>
> isnt there any way to enforce the function to be really immutable ?
Never say never. :)
And to answer your question -- your IMMUTABLE function may reference
other functions (even VOLATILE). So you may create a "caller" immutable
function which just calls your non-immutable function. But from
performance standpoint there is not much difference (probably your
STABLE function will be faster than STABLE inside IMMUTABLE function).
Ah, and please note that some time in future PostgreSQL may require
that IMMUTABLE function calls only IMMUTABLE functions.
Regards,
Dawid
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: qnex42@gmail.com, weigelt@metux.de
Subject: Re: immutable functions vs. join for lookups ?
In-Reply-To: <758d5e7f050422031579a04963@mail.gmail.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