On Sun, Mar 2, 2014 at 1:55 PM, big stone <[email protected]> wrote:

>    ==> Why such a 'x6' speed-up, as we need to scan the whole table anyway
> ?
>

SQLite implements GROUP BY by sorting on the terms listed in the GROUP BY
clause.  Then as each row comes out, it compares the GROUP BY columns to
the previous row to see if a new "group" needs to be started.  Sorting is
O(NlogN) if you don't have an index.


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

Reply via email to