Iván de Prado wrote:
> SELECT ddate, sum(hits) from a_idadvertiser_site_hostname_bench where ddate < 
> '2013-08-01' group by ddate;
>
> SCAN TABLE a_idadvertiser_site_hostname_bench (~333333 rows)
> USE TEMP B-TREE FOR GROUP BY
>
> [...] means that this query is running almost 6 times slower than the one
> without the group by. How could that be?
>
> Any ideas about what's the problem

SQLite sorts the entire table before aggregating it.

> how could we solve it?

Create an index on the ddate column.


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to