Re: BUG #12869: PostGIS 2.2 can't compile against 9.5 dev branch

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Paragon Corporation" <lr(at)pcorp(dot)us>
Cc: "'David G(dot) Johnston'" <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org, "'PostGIS Development Discussion'" <postgis-devel(at)lists(dot)osgeo(dot)org>
Subject: Re: BUG #12869: PostGIS 2.2 can't compile against 9.5 dev branch
Date: 2015-03-22 23:00:40
Message-ID: 3960.1427065240@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Paragon Corporation" <lr(at)pcorp(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Paragon Corporation 2015-03-23 03:27:12 Re: BUG #12869: PostGIS 2.2 can't compile against 9.5 dev branch
Previous Message Paragon Corporation 2015-03-22 22:46:34 Re: BUG #12869: PostGIS 2.2 can't compile against 9.5 dev branch