pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Paragon Corporation <lr@pcorp.us>
Cc: 'David G. Johnston' <david.g.johnston@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #12869: PostGIS 2.2 can't compile against 9.5 dev branch
Date: Sun, 22 Mar 2015 18:16:16 -0400
Message-ID: <2721.1427062576@sss.pgh.pa.us> (raw)
In-Reply-To: <000401d064be$5bfd11a0$13f734e0$@pcorp.us>
References: <001c01d0647a$397bb260$ac731720$@pcorp.us>
	<CAKFQuwZtQxTcEQRpXk4Je9=1XSUSA40=BTi62M+GNH96P6dDgg@mail.gmail.com>
	<14130.1427035560@sss.pgh.pa.us>
	<CAKFQuwYeW417RRrq676xe5rSoJ2Qaf_D=DO=o_sNREvBDiLDRg@mail.gmail.com>
	<14986.1427037326@sss.pgh.pa.us>
	<CAKFQuwY-TgnXcYXpbQ0pa27VvE0RgGMw02krgXzSPDKevsWbng@mail.gmail.com>
	<000401d064be$5bfd11a0$13f734e0$@pcorp.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

"Paragon Corporation" <lr@pcorp.us> writes:
> Guys I tried increasing cost with the ST_Reclass function to 2000 and it didn't help.  The function is called for every single output.    The only thing that helps is setting this to VOLATILE as Tom suggests.  I guess we can do that as some sort of fix for these kinds of functions though I'm not sure if that would cause other issues.

I think that would be a very bad idea; it would foreclose optimizations
that you *do* want.  Much better, if you are relying on single-evaluation
behavior for a non-volatile function, is to use one of the documented
optimization fences: either a CTE, or an OFFSET 0 in a sub-select.

TBH, this particular example does not fill me with concern, because
(a) it's obviously artificial, and (b) you'd really never notice if the
function got evaluated 3 times not once, if you hadn't put in that NOTICE.
I grant that there may be cases where you're worried about avoiding
multiple evaluations *per row* over some large number of rows, but to
discuss that type of problem we'd have to see what your coding habits are
like for such cases.  An immutable function being fed constants is not
going to create that type of problem.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (13+ messages)  latest in thread

Message-ID: <2721.1427062576@sss.pgh.pa.us>
Permalink:  ../2721.1427062576@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2721.1427062576@sss.pgh.pa.us

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, lr@pcorp.us, david.g.johnston@gmail.com
  Subject: Re: BUG #12869: PostGIS 2.2 can't compile against 9.5 dev branch
  In-Reply-To: <2721.1427062576@sss.pgh.pa.us>
  References: <001c01d0647a$397bb260$ac731720$@pcorp.us> <CAKFQuwZtQxTcEQRpXk4Je9=1XSUSA40=BTi62M+GNH96P6dDgg@mail.gmail.com> <14130.1427035560@sss.pgh.pa.us> <CAKFQuwYeW417RRrq676xe5rSoJ2Qaf_D=DO=o_sNREvBDiLDRg@mail.gmail.com> <14986.1427037326@sss.pgh.pa.us> <CAKFQuwY-TgnXcYXpbQ0pa27VvE0RgGMw02krgXzSPDKevsWbng@mail.gmail.com> <000401d064be$5bfd11a0$13f734e0$@pcorp.us> <2721.1427062576@sss.pgh.pa.us>

* 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