Volatility - docs vs behaviour?

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Subject: Volatility - docs vs behaviour?
Date: 2014-06-30 09:24:55
Message-ID: 53B12CE7.5090506@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi all

The docs say:

"For best optimization results, you should label your functions with the
strictest volatility category that is valid for them."

http://www.postgresql.org/docs/current/interactive/xfunc-volatility.html

... but I recall discussion here suggesting that in fact IMMUTABLE
functions may not be inlined where you'd expect, e.g.

http://www.postgresql.org/message-id/CAFj8pRBF3Qr7WtQwO1H_WN=hhFGk0semwhdE+ODz3iyv-TroMQ@mail.gmail.com

That's always seemed counter to my expectations. Am I just
misunderstanding? Tom's comment seemed to confirm what Pavel was saying.

I know STRICT can prevent inlining (unfortunately, though necessarily),
but it seems inexplicable that IMMUTABLE should. If it can, then the
documentation is wrong.

Which is it?

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2014-06-30 14:04:02 Re: GIST optimization to limit calls to operator on sub nodes
Previous Message Pujol Mathieu 2014-06-30 07:40:00 Re: GIST optimization to limit calls to operator on sub nodes