Hi, <div><br></div><div>ST_Subdivide can help you split up your polygons to have less points in their edges. After that, ST_Intersects should be the fastest way to check a point-in-polygon relation. </div><div><br></div><div>To check if you can service a customer, you don't need a count - WHERE EXISTS() should be faster and enough. </div><div><br><div class="gmail_quote"><div dir="ltr">On аў, 3 ліп 2018, 12:50 Devdatta Tengshe <<a href="mailto:devdatta@tengshe.in">devdatta@tengshe.in</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>Hi all,</div><div><br></div><div><div>I'm developing an API which will help us figure out if we can server a potential customer. For this, I have a PostGIS Table with polygon representing the service area of each of our store. There could be up to 10,000 polygons in the table. These polygons are geometries in EPSG:4326 and has a Gist Index.</div><div><br></div><div>Currently I'm using the following query to figure out if we can potentially service the customer:</div><div><br></div><div>Select count(id) from service_areas where ST_CoveredBy(ST_SetSRID(ST_MakePoint(78.46239,17.30360),4326), geom);</div><div><br></div><div>Is there a faster way to get if any of the polygons cover my input Point?</div></div><div><br></div><br clear="all"><div><div class="m_8953877275311047357gmail_signature"><div dir="ltr"><div><div dir="ltr"><font color="#999999" size="2">Regards,</font><div><font size="2" color="#444444">Devdatta</font></div></div></div></div></div></div>
</div>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a></blockquote></div></div>