Hi Simon,

I just stumbled about this post.
> 


On 21.03.2011, at 06:34, Simon Slavin wrote:


> 
> Suppose you have a TABLE employees with ten thousand rows and no indexes, and 
> you execute
> 
> SELECT id,firstname,surname FROM employees WHERE firstname='Guilherme' AND 
> age=46
> 
> The query optimizer has a choice.  It can first pick out all the Guilhermes, 
> and then find those who are the right age, or it can first pick out all the 
> 46 year olds, then find any with the right firstname.  It has to do two 
> operations, and it must do the first one on the entire list of members.  The 
> only way to make things faster is if the second operation needs to worry 
> about the smallest number of rows possible.  There are only two options: name 
> first then age, or age first then name.
> 

Is it really that way? I somehow assumed in that non-index case there is just a 
single table scan involved? Fetching each record, calculating 
firstname='Guilherme' AND age=46 for each, and selecting the matching records? 

confused,
/eno

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to