-----Ursprüngliche Nachricht----- Von: Gerald Dachs [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 22. September 2006 11:28 An: sqlite-users@sqlite.org Betreff: Re: [sqlite] Performance question
>My sql knowledge may be a little bit rusty and I have really no idea how sqlite is doing "between" >querys. Anyway, once I have learned never to use between because your query is equivalent to: >where ((x >= high_x and x <= low_x) or (x >= low_x and x <= high_x) and (y >= high_y and y <= > low_y) or (y >= low_y and y <= high_y)) I think it is: where (x >= low_x and x <= high_x) and (y >= low_y and y <= high_y), i.e. in "between a and b", a should be lower or equal to b (you don't get a result otherwise) So it's without the "or" part. But I will test the other statement too. >because of the or operators you will get a union of 4 selects. Maybe I am wrong but I would expect >that "where x >= low_x and x <= high_x and y >= low_y and y <= high_y" should be faster and all >what you need. You have indices on x and y, haven't you? Yep :-) Cheers Michael