<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>Jim --<br><br>Can we see the SQL and table/index defintions (or something close, anyway) ? The limit won't help much if the database has to process all x-thousand tuples before deciding it has the number needed. Are you using an "order by" clause ?<br><br>If you can run the query in an EXPLAIN ANALYZE statement (wrap it in a transaction and roll it back when done if it does any updates etc. that you don't want to keep) ... this will take longer than the regular evaluation because of the timing calls but gives useful information about what the planner is doing.<br><br>HTH,<br><br>Greg Williamson<br><br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font face="Tahoma"
 size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Jim Jim <gamecleaner@hotmail.com><br><b><span style="font-weight: bold;">To:</span></b> postgis-users@postgis.refractions.net<br><b><span style="font-weight: bold;">Sent:</span></b> Tuesday, April 14, 2009 2:00:29 AM<br><b><span style="font-weight: bold;">Subject:</span></b> [postgis-users] Too many results<br></font><br>


<style>
..hmmessage P
{
margin:0px;padding:0px;}
body.hmmessage
{
font-size:10pt;font-family:Verdana;}
</style>

Hello,<br><br>I have a table with 2d points and lines. My query is a rectangle and a line. The problem is there are too many results to the point where it becomes non-practical to wait. So I wanted to limit the results. I know that this can be done by LIMIT N, however, this does not stop searching after finding N results and the whole point is not to wait too long.<br><br>Do you have any ideas on how this could be accomplished? I suppose when it comes to intersections and geometrical problems this is quite important.<br><br>Thank you!<br><br><hr>Get the New Internet Explore 8 Optimised for MSN. <a rel="nofollow" target="_blank" href="http://extras.uk.msn.com/internet-explorer-8/?ocid=T010MSN07A0716U">Download Now</a></div></div></div><br>

      </body></html>