I meant:
SELECT title FROM tracks
WHERE  title >= :last_title AND
  (title>:last_title OR id>:last_id) AND title LIKE %Mad% 
ORDER BY title,id;
better than
SELECT title FROM tracks
WHERE title LIKE %Mad% AND
  title >= :last_title AND
  (title>:last_title OR id>:last_id)
ORDER BY title,id;

?
Furthermore 
can the index improve select performance in both previous
cases?

Igor Tandetnik ha scritto:
> "Andrea Galeazzi" <[email protected]> wrote in
> message news:[email protected]
>   
>> Is the order of WHERE clauses important as C-language is?
>>     
>
> No. The optimizer may, and often does, reorder the conditions in the 
> WHERE clause.
>
>   
>> For instance is
>>
>> SELECT title FROM tracks
>>       WHERE title ((title=:last_title AND id>:last_id) AND LIKE %Mad%
>>
>> better than
>>
>> SELECT title FROM tracks
>>       WHERE title LIKE %Mad% AND ((title=:last_title AND id>:last_id)
>>
>> ?
>>     
>
> Neither is better than the other: both are invalid and will produce a 
> syntax error.
>
>   
>> Anyway, can the index improve select performance in both previous
>> cases?
>>     
>
> No. These statements won't actually run, and are thus beyond help.
>
> Igor Tandetnik 
>
>
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
> __________ NOD32 3941 (20090317) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>
>
>   

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to