On 3 Apr 2017, at 12:27am, Hamish Allan <ham...@gmail.com> wrote:

> SELECT d FROM x WHERE b = 1 GROUP BY c ORDER BY a;

Your problem comes down to this:

If you are GROUPing BY c, why do you want ORDER BY a ?

If you remove the "ORDER BY a" clause then the ideal index would be on (b, c).  
But to deal with the ORDER BY we need to know whether "a" is a subgroup of "c".

My guess is that (b, c, a) would be the best index.  But it depends on whether 
a is a subgroup of b or c.

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

Reply via email to