Kristoffer Danielsson wrote: > A: SELECT COUNT(DataID) FROM Data GROUP BY DataID ORDER BY COUNT(DataID); > > B: SELECT COUNT(DataID) AS X FROM Data GROUP BY DataID ORDER BY X; > > Is statement B faster than A? Why?
Last time I checked, SQLite didn't perform any kind of common subexpression elimitation. Its expression evaluator was very simple-minded, closely following the syntax tree. Things might have improved since then, but I wouldn't be surprised if statement A calls count() twice per row while statement B only once. I also think that any resulting difference in performance is likely to be immeasurably small. Why don't you test it and find out, if you are really curious? Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users