{"id":857,"date":"2011-10-23T18:47:33","date_gmt":"2011-10-24T01:47:33","guid":{"rendered":"http:\/\/blog.light42.com\/wordpress\/?p=857"},"modified":"2012-10-23T18:49:36","modified_gmt":"2012-10-24T01:49:36","slug":"super-double-box-search-off","status":"publish","type":"post","link":"http:\/\/blog.light42.com\/wordpress\/?p=857","title":{"rendered":"Super Double-Box Search-Off"},"content":{"rendered":"<p><img decoding=\"async\" src=\"http:\/\/blog.light42.com\/wordpress\/wp-content\/uploads\/2012\/06\/PostgreSQL_logo.3colors.120x120.png\" alt=\"pg_logo\" align=\"right\" height=108px width=108px \/><\/p>\n<p><em>&#8220;A quick estimate of performance of PostGIS 2 with<br \/>\n  geometry bounding boxes as doubles vs as floats&#8221;<\/em><\/p>\n<p>All tests performed on Linux 2.6.38 x86_64<br \/>\nPostgreSQL 9.0.5<br \/>\n  shared_buffers = 2400MB<br \/>\n  temp_buffers = 64MB<br \/>\n  work_mem = 512MB<br \/>\n  maintenance_work_mem = 200MB<\/p>\n<p><strong>The Test  &#8211;  TIGER 2010 California<\/strong><\/p>\n<p>TIGER provides many possibilities for tests.. The one I chose here<br \/>\nuses PLACE (a large&#8217;ish <strong>MULTIPOLY<\/strong>) and EDGE (<strong>MULTILINE<\/strong>)<\/p>\n<p>A random sampling of 100 EDGES in California shows the following characteristics:<\/p>\n<p><code>select st_npoints(the_geom) from ca_edges order by random() limit 100;<\/code><br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\nmin,median,mean,max    stdev<br \/>\n2, 5.15, 16.333, 212   34.23<\/p>\n<p>sorted, the first dozen entries are 2, the last are the following<br \/>\n[ &#8230; 36,37,43,44,51,57,58,68,68,79,206,206,212]<\/p>\n<p>I reasoned that although many EDGES are trivially short, there<br \/>\nexist substantial numbers of non-trivial EDGES, so they would be ok for a test.<\/p>\n<p>Next, pick some large PLACE geometries..<br \/>\nFrom the Dozen largest (by area) PLACE rows, I picked 4 well-known cities<\/p>\n<p>now, the test (with indexes in place I trust)<\/p>\n<p>&#8212;&#8212;&#8212;-<br \/>\n<code>select count(*) from ca_edges where st_intersects( the_geom,<br \/>\n(select st_envelope(the_geom) from ca_place where name = 'City_Name') );<\/code><br \/>\n&#8212;&#8212;&#8212;-<\/p>\n<p><strong>Results:<\/strong><\/p>\n<p>place_name,trunk_cnt,trunk_time,dblbox_cnt,dblbox_time<br \/>\nBakersfield,39691,24.230,39691,25.275<br \/>\nFresno,36527,24.217,36527,25.194<br \/>\nOakland,44404,24.395,44404,25.680<br \/>\nLancaster,16566,23.983,16566,25.194<\/p>\n<p><em>preliminary conclusions<\/em><\/p>\n<p>the search times were almost the same for each of the 4 cases<br \/>\nand I did not detect change with multiple runs of the same query<br \/>\n(though I could have tested that more, too)<\/p>\n<p>search times were fast enough such that I believe indexes are being used<br \/>\n(I did not check all indexes carefully, but the database setup was the same<br \/>\nfor both test contexts, so if they missed something, both tests likely missed<br \/>\nin the same way)<\/p>\n<p>the result counts for both trunk and dblbox match, as a sanity check<\/p>\n<p>performance hit is around 4% in each case<\/p>\n<p>=======<\/p>\n<p>caveat: I could have misjudged and chosen a poor test case for some<br \/>\nobscure-to-me reason.. hopefully, this is useful and informative<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;A quick estimate of performance of PostGIS 2 with geometry bounding boxes as doubles vs as floats&#8221; All tests performed on Linux 2.6.38 x86_64 PostgreSQL 9.0.5 shared_buffers = 2400MB temp_buffers = 64MB work_mem = 512MB maintenance_work_mem = 200MB The Test &#8211; TIGER 2010 California TIGER provides many possibilities for tests.. The one I chose here [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.light42.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/857"}],"collection":[{"href":"http:\/\/blog.light42.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.light42.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.light42.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.light42.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=857"}],"version-history":[{"count":10,"href":"http:\/\/blog.light42.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/857\/revisions"}],"predecessor-version":[{"id":867,"href":"http:\/\/blog.light42.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/857\/revisions\/867"}],"wp:attachment":[{"href":"http:\/\/blog.light42.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.light42.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=857"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.light42.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}