Re: Stored procedure declared as VOLATILE => no good optimization is done - Mailing list pgsql-performance

From Tatsuo Ishii
Subject Re: Stored procedure declared as VOLATILE => no good optimization is done
Date
Msg-id 20101016.104738.1076064300636336418.t-ishii@sraoss.co.jp
Whole thread Raw
In response to Re: Stored procedure declared as VOLATILE => no good optimization is done  (Merlin Moncure <mmoncure@gmail.com>)
Responses Re: Stored procedure declared as VOLATILE => no good optimization is done  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
> broadly speaking:
> *) function generates same output from inputs regardless of what's
> going on in the database, and has no side effects: IMMUTABLE

So can I say "if a function is marked IMMUTABLE, then it should never
modify database"? Is there any counter example?

> *) function reads (only) from tables, or is an immutable function in
> most senses but influenced from the GUC (or any other out of scope
> thing): STABLE

It seems if above is correct, I can say STABLE functions should never
modify databases as well.

> *) all other cases: VOLATILE (which is btw the default)
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp

pgsql-performance by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Stored procedure declared as VOLATILE => no good optimization is done
Next
From: Navkirat Singh
Date:
Subject: UUID performance as primary key