pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Paragon Corporation <lr@pcorp.us>
To: 'Tom Lane' <tgl@sss.pgh.pa.us>
Cc: 'David G. Johnston' <david.g.johnston@gmail.com>
Cc: pgsql-bugs@postgresql.org
Cc: 'PostGIS Development Discussion' <postgis-devel@lists.osgeo.org>
Subject: Re: BUG #12869: PostGIS 2.2 can't compile against 9.5 dev branch
Date: Sun, 22 Mar 2015 23:27:12 -0400
Message-ID: <000801d06519$410aa9b0$c31ffd10$@pcorp.us> (raw)
In-Reply-To: <3960.1427065240@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>
	<002401d064f2$0d10c350$273249f0$@pcorp.us>
	<3960.1427065240@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Tom,


>> Here one  that come to mind

>> SELECT ST_GeometryN(newgeom,1) As geom1, ST_GeometryN(newgeom,2) As 
>> geom2 FROM ( SELECT ST_Simplify(geom,25)  As newgeom FROM sometable) 
>> As foo;

>> If I am not mistaken -- please correct me if I am wrong.  The above 
>> example would cause ST_Simplify to be called for each ST_GeometryN.

> Indeed, and that is exactly what happens in every PG release for time out
of mind, if that's actually how you're coding it without using any method
that would prevent flattening of the subquery.  Check it with 

> EXPLAIN VERBOSE if you doubt that.  The patch I committed two weeks ago
has no impact whatsoever on this example, because that's not a table-free
subquery.

> I suspect that (a) you are using OFFSET 0 in the subquery, (b) you already
have ST_Simplify marked as volatile, or (c) the performance hit from
multiple evaluations isn't as drastic as you think.

> regards, tom lane

Sorry for the false alarm.  Indeed you are right and the change is not as
much of a change as I thought.

This revised version of the query -- triggers a double call in older
versions of PostgreSQL too and since this would be the more common case not
much has changed in behavior.  I think for raster work most people wrap
these kind of calls in CTEs anyway.

DROP TABLE IF EXISTS t2;
CREATE TABLE t2(rast raster);
INSERT INTO t2(rast)
SELECT ST_SetValue(
			ST_SetValue(
				ST_AddBand(
					ST_MakeEmptyRaster(100, 100, 10, 10,
2, 2, 0, 0, 0),
					1, '32BF', 1, 0
				),
				1, 1, 1, 3.14159
			),
			1, 10, 10, 2.71828
		) As rast;

SELECT
	ST_Value(t.rast, 1, 1, 1),
	ST_Value(t.rast, 1, 10, 10),
	ST_BandNoDataValue(rast, 1)
FROM (
	SELECT ST_Reclass(
		rast,
		ROW(1,
'a-100]:50-1,(-100-1000]:150-50,(1000-10000]:254-150', '8BUI', 0)
	) AS rast  FROM t2
) AS t;


So I'll just put an OFFSET 0 on this regression query and call it a day.

Thanks,
Regina

			




-- 
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)

Message-ID: <000801d06519$410aa9b0$c31ffd10$@pcorp.us>
Permalink:  ../000801d06519$410aa9b0$c31ffd10$@pcorp.us/
Also on:    postgresql.org/message-id/000801d06519$410aa9b0$c31ffd10$@pcorp.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: lr@pcorp.us, tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, postgis-devel@lists.osgeo.org
  Subject: Re: BUG #12869: PostGIS 2.2 can't compile against 9.5 dev branch
  In-Reply-To: <000801d06519$410aa9b0$c31ffd10$@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> <2721.1427062576@sss.pgh.pa.us> <002401d064f2$0d10c350$273249f0$@pcorp.us> <3960.1427065240@sss.pgh.pa.us> <000801d06519$410aa9b0$c31ffd10$@pcorp.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