Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YZoAT-00019v-6q for pgsql-bugs@arkaria.postgresql.org; Sun, 22 Mar 2015 22:16:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YZoAS-0003Ge-L7 for pgsql-bugs@arkaria.postgresql.org; Sun, 22 Mar 2015 22:16:24 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YZoAR-0003GX-KU for pgsql-bugs@postgresql.org; Sun, 22 Mar 2015 22:16:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YZoAO-0001Yk-FV for pgsql-bugs@postgresql.org; Sun, 22 Mar 2015 22:16:21 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id t2MMGGk6002722; Sun, 22 Mar 2015 18:16:16 -0400 From: Tom Lane To: "Paragon Corporation" cc: "'David G. Johnston'" , pgsql-bugs@postgresql.org Subject: Re: BUG #12869: PostGIS 2.2 can't compile against 9.5 dev branch In-reply-to: <000401d064be$5bfd11a0$13f734e0$@pcorp.us> References: <001c01d0647a$397bb260$ac731720$@pcorp.us> <14130.1427035560@sss.pgh.pa.us> <14986.1427037326@sss.pgh.pa.us> <000401d064be$5bfd11a0$13f734e0$@pcorp.us> Comments: In-reply-to "Paragon Corporation" message dated "Sun, 22 Mar 2015 12:36:33 -0400" Date: Sun, 22 Mar 2015 18:16:16 -0400 Message-ID: <2721.1427062576@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org "Paragon Corporation" 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