Re: Stored procedure declared as VOLATILE => no good optimization is done

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: mmoncure(at)gmail(dot)com
Cc: damon(at)huddler-inc(dot)com, pgsql-performance(at)postgresql(dot)org
Subject: Re: Stored procedure declared as VOLATILE => no good optimization is done
Date: 2010-10-16 01:47:38
Message-ID: 20101016.104738.1076064300636336418.t-ishii@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Navkirat Singh 2010-10-16 01:58:04 UUID performance as primary key
Previous Message Craig Ringer 2010-10-16 01:17:59 Re: [PERFORM] help with understanding EXPLAIN