[postgis-devel] Strange result about spatial indexes?

Paul Ramsey pramsey at cleverelephant.ca
Fri Aug 14 20:54:34 PDT 2009


On Fri, Aug 14, 2009 at 8:39 PM, Tom Lane<tgl at sss.pgh.pa.us> wrote:
> Paul Ramsey <pramsey at cleverelephant.ca> writes:
>> Anyhow, you asked why we detoast a slice and the answer is, because we
>> need the box in order to run the other tests. The case with the
>> immutable function on one half of the query seems to call the
>> consistent test a lot less often, and as a result the whole thing runs
>> a lot faster. Why that is, is the question.
>
> Have you got any actual evidence of fewer calls?  What it looks like to
> me is that the net result of the function is to detoast the lookup key
> once before it gets fed to the index machinery.  I think it's the same
> number of consistent calls but they're not having to detoast their
> argument.  You failed to show EXPLAIN plans for any of these queries
> but I'll bet they are scanning an index on p2.geom, not p1.

I will attempt to obtain said evidence. The only thing I'm going on is
that the profile of the fast query still shows the most time being
spent in LWGEOM_gist_consistent, just a lower proportion -- ie: fewer
calls, relatively speaking. I'll forward the explains from the
original poster.

P.

>                        regards, tom lane
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>



More information about the postgis-devel mailing list