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
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 19:00:40 -0400
Message-ID: <3960.1427065240@sss.pgh.pa.us> (raw)
In-Reply-To: <002401d064f2$0d10c350$273249f0$@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>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

"Paragon Corporation" <lr@pcorp.us> writes:
> The more common use case (the ones I am really worried about are cases where
> we have a function that takes a large composite object and outputs another
> which then gets passed to another PostGIS function that cuts off small
> pieces.

> 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


-- 
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: <3960.1427065240@sss.pgh.pa.us>
Permalink:  ../3960.1427065240@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3960.1427065240@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, postgis-devel@lists.osgeo.org
  Subject: Re: BUG #12869: PostGIS 2.2 can't compile against 9.5 dev branch
  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>

* 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