2013/4/25 James K. Lowden <jklow...@schemamania.org> > > Nonsense. The query parser sees GROUP BY A,B. The optimizer sees an > index ordered B,A. By permuting the order of the columns in the GROUP > BY clause, it finds a match for the index and uses it. > > Yes, the problem is O(n^2), where n is the number of columns in the > GROUP BY, but n is always small; even 7 columns could be checked in > less than 50 iterations. >
I believe its O(n!), but still doable for small n. I don't know the inner workings of the query optimizer but mabye instead of asking/check for a index of every permutation of the columns in the group by, it could just check if an index exists which covers all columns (even the sorting order doesn't matter). (the virtual table api needs an addition for that to work) _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users