WG: [postgis-users] very Poor Performance for Contains

David Blasby dblasby at refractions.net
Tue Jun 8 09:26:05 PDT 2004


The reason why contains() is so slow is because it starts from scratch 
every test.  It doesnt save any of the information about the geometry 
objects, so it has to compute them every time you run contains().

Second, its using extended math routines so that it will ALWAYS return 
the correct result.

Third, doing a contains() on a complex polygon is a lot of work!



The slow query is probably because the PostGIS->WKB->bytea->Output Text 
is not highly optimized.  You can try lwgeom and see if its faster for you.

dave



More information about the postgis-users mailing list