On 25 Feb 2016, at 2:31am, admin at shuling.net wrote:

> Thank you.

You're welcome.

> In that case, if I create an index for (F1, F2, F3), then the
> next time when I invoke SELECT statement like this:
> 
> SELECT * FROM MyTable ORDER BY F1, F2, F3;
> 
> Then SQLite will utilize the index automatically, is that correct?

Correct.

> If I use
> 
> SELECT * FROM MyTable ORDER BY F1, F2;
> 
> Then the above index cannot be utilized and the speed will be slow again?

No.  If you do not have another index for F1, F2 then SQLite will use that 
index for that ORDER BY clause.  You will end up with rows sorted by F1, F2, F3 
even though you didn't ask for the F3.  Nevertheless this does correctly 
satisfy your request for ORDER BY F1, F2.

Simon.

Reply via email to