<div dir="ltr"><span style="font-size:12.8px">Goedemiddag,</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Ik ben al de hele dag bezig om mijn PostGIS query te optimaliseren maar het lukt me niet.</div><div style="font-size:12.8px">Hopelijk zijn er hier op deze lijst enige PostGIS goeroes aanwezig ;)</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Ik heb een eenvoudige tabel met BRP-data (gewaspercelen). Iets meer dan 750k rijen.</div><div style="font-size:12.8px">Ik heb 7 kolommen waarvan eentje van het type 'geometry(Polygon)' is.</div><div style="font-size:12.8px">Ik heb een GIST index daarop.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Deze data wordt gebruikt in een webapplicatie met OpenLayers. De boundingbox wordt naar de server gestuurd en de percelen die daarin zitten worden terug gestuurd.</div><div style="font-size:12.8px">De query:</div><div style="font-size:12.8px"><div><font face="monospace, monospace">select *</font></div><div><font face="monospace, monospace">from BRP2015  </font></div><div><font face="monospace, monospace">where ST_Intersects(Polygon,'0103000000 ...')</font></div><div>Ik heb hier de bbox niet in z'n geheel geplakt.</div><div><br></div><div>De explain:</div><div><div><font face="monospace, monospace">Bitmap Heap Scan on brp2015 (cost=30.53..3214.62 rows=275 width=524) (actual time=0.608..6.551 rows=882 loops=1)</font></div><div><font face="monospace, monospace">  Recheck Cond: (polygon && '0103000000 ...'</font></div><div><font face="monospace, monospace">  Filter: _st_intersects(polygon, '0103000000 ...'</font></div><div><font face="monospace, monospace">  Rows Removed by Filter: 36</font></div><div><font face="monospace, monospace">  ->  Bitmap Index Scan on brp2015_polygon_gist_idx  (cost=0.00..30.46 rows=824 width=0) (actual time=0.416..0.416 rows=918 loops=1)</font></div><div><font face="monospace, monospace">        Index Cond: (polygon && '0103000000 ...'</font></div><div><br></div></div><div>Als ik het allemaal goed begrepen heb dan wordt de index netjes gebruikt.</div><div><br></div><div>Bovenstaande voorbeeldquery geeft 882 rijen terug en duurt rond de 2 seconden.</div><div>Dan is er nog de tijd dat het duurt voordat de nieuwe data gerenderd is en dan is het zomaar 4-5 seconden voordat de data in de browser wordt getoond.</div><div><br></div><div>Ik gebruik PostgreSQL 9.3.3 op Ubuntu en PostGis v2.1 (USE_GEOS=1 USE_PROJ=1 USE_STATS=1)</div><div><br></div><div>Het doel is om de query binnen 1s resultaat te laten terug geven.</div><div><br></div><div>Iemand nog een richting waar ik het kan zoeken?</div><div><br></div><div>Alvast bedankt.</div></div><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><span><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12.6667px;font-family:Arial;color:rgb(34,34,34);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;background-color:rgb(255,255,255)"><br></span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12.6667px;font-family:Arial;color:rgb(34,34,34);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;background-color:rgb(255,255,255)">Met vriendelijke groet,</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12.6667px;color:rgb(34,34,34);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;background-color:rgb(255,255,255)"><font face="arial, helvetica, sans-serif">Paul </font></span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><b style="font-weight:normal"><br></b></p><div dir="ltr" style="margin-left:0pt"><table style="border:none;border-collapse:collapse"><colgroup><col width="467"></colgroup><tbody><tr style="height:0px"><td style="border:1px solid rgb(204,204,204);vertical-align:top;padding:7px"><br><div dir="ltr" style="margin-left:0pt"><table style="border:none;border-collapse:collapse"><colgroup><col width="145"><col width="439"></colgroup><tbody><tr style="height:0px"><td style="border:0px solid rgb(0,0,0);vertical-align:top;padding:7px"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12.6667px;font-family:Arial;color:rgb(34,34,34);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;background-color:rgb(255,255,255)"><a href="http://www.topx-geo-ict.nl" target="_blank"><img src="https://docs.google.com/uc?id=0B8UeIGgvyx2VUEhWSzJiZWZUXzhrbWlPVkNiY0tVNTZRMFpF&export=download" width="78" height="96" alt=" TopX Geo-ICT"></a></span></p></td><td style="border:0px solid rgb(0,0,0);vertical-align:top;padding:7px"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:6pt"><span style="font-size:13.3333px;font-family:Verdana;color:rgb(0,0,0);font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;background-color:rgb(248,248,248)">Paul Meems</span><span style="font-size:13.3333px;font-family:Verdana;color:rgb(0,0,0);font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;background-color:rgb(248,248,248)"><br></span><span style="font-size:13.3333px;font-family:Verdana;color:rgb(128,128,128);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;background-color:rgb(248,248,248)">Senior GIS consultant</span><span style="font-size:13.3333px;font-family:Verdana;color:rgb(128,128,128);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;background-color:rgb(248,248,248)"><br></span><span style="font-family:Verdana;color:rgb(34,34,34);font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;background-color:rgb(248,248,248)"><font size="1">06-53989481</font></span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:6pt"><span style="color:rgb(0,0,0);font-family:Verdana;font-size:13.3333px;white-space:pre-wrap;line-height:1.38;background-color:rgb(248,248,248)">Wij bieden ondersteuning
</span><span style="font-size:13.3333px;font-family:Verdana;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:rgb(248,248,248)">voor </span><a href="http://www.mapwindow.org/" style="line-height:1.38;font-size:12.8px;text-decoration:none" target="_blank"><span style="font-size:13.3333px;font-family:Verdana;color:rgb(17,85,204);text-decoration:underline;vertical-align:baseline;white-space:pre-wrap;background-color:rgb(248,248,248)">MapWindow GIS</span></a></p></td></tr></tbody></table></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:6pt"><a href="https://mapwingis.codeplex.com/releases" style="text-decoration:none" target="_blank"><span style="font-size:13.3333px;font-family:Verdana;color:rgb(17,85,204);font-weight:400;font-style:normal;font-variant:normal;text-decoration:underline;vertical-align:baseline;white-space:pre-wrap;background-color:rgb(248,248,248)">Download the latest MapWinGIS mapping engine.</span></a></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:6pt"><a href="https://mapwindow5.codeplex.com/releases" style="text-decoration:none" target="_blank"><span style="font-size:13.3333px;font-family:Verdana;color:rgb(17,85,204);font-weight:400;font-style:normal;font-variant:normal;text-decoration:underline;vertical-align:baseline;white-space:pre-wrap;background-color:rgb(248,248,248)">Download the latest MapWindow 5 open source desktop application.</span></a></p></td></tr></tbody></table></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><br></p></span>
</div></div></div></div></div></div></div></div></div>
</div>