Monthly Archives - March 2008

Speeding up GROUP BY if you want aproximate results

Doing performance analyzes today I wanted to count how many hits come to the pages which get more than couple of visits per day. We had SQL logs in the database so It was pretty simple query:

Shell

select sum(cnt) from (select count(*) cnt from performance_log_080306 group by page having cnt>2) pv;

1

select sum(cnt) from (select […]

Read more