You might also consider a trigger to calculate the distance once on 
insert/update.  They you could use an index.

On 6/14/2011 4:53 AM, Simon Slavin wrote:
> On 14 Jun 2011, at 12:11pm, Martin.Engelschalk wrote:
>
>> make sure you have an index on  category and distance, like
>>
>> create index MyIndex on Location  (category, distance)
> Peter is calculating distance inside his SELECT, but I agree that an index on 
> (category) is an excellent idea.
>
> The other thing is that this is a bit like RTREEs.  So Peter, you might like 
> to read
>
> <http://www.sqlite.org/rtree.html>
>
> I don't know if it's worth using rtrees in your particular example but you 
> might find them useful.
>
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to