[postgis-users] GeometryCollection vs LineString speed

Ron Mayer rm_postgis at cheapcomplexdevices.com
Wed Feb 23 01:22:41 PST 2005


strk at refractions.net wrote:
> What postgis version ?

CVS as of earlier today.

Ron Mayer wrote:
 > Should I expect "&&" to be much faster on GeometryCollections
 > than on LineStrings?

I think I mostly figured it out.

I created another table, totally identical to the first,
but created the LINIESTRINGS with AddBBOX() as suggested here:
   http://postgis.refractions.net/docs/ch06.html#addbbox
This new table with linestrings behaves exactly as good as
the one with GEOMETRYCOLLECTION.  I'm guessing geometrycollections
have the bbox by default and linestrings don't (but I didn't
read the docs carefully enough to notice).


So anyway, my problem's solved; but I'm still curious about
a couple things.

  * Too bad the index didn't seem to cache the bbox "magically"

  * Would "addbbox()" be a good thing to mention on the new
    performance typs documentation page:
    http://postgis.refractions.net/docs/ch05.html
    I had looked there; but didn't notice addbbox until later.



Just for completeness, here are the final times:

 >     TIME     | what..
 >   -----------+-----------------------------------
 >   3.71 sec   | seq scan using LINESTRING
 >   1.51 sec   | seq scan using GEOMETRYCOLLECTION
     1.45 sec   | seq scan using LINESTRING and AddBBox()
 >     .59 sec  | index scan using LINESTRING
 >     .37 sec  | index scan using GEOMETRYCOLLECTION
       .36 sec  | index scan using LINESTRING and AddBBox()




More information about the postgis-users mailing list