GROUP BY performance I have a query like this:

SELECT HOUR(datetime) as Hour, COUNT(*) as hits, SUM(clicks) 
FROM visitors_log_table 
WHERE datetime &gt;= CURDATE() 
GROUP BY Hour 
WITH ROLLUP


It works fine. But I don't need  GROUP BY for the clicks column.
I only need the WITH ROLLUP result for it.

This query is just an example. In my query I have many more columns like the clicks column where I don't need a GROUP BY.

My table is very, very large, so performance is important. The datetime column is indexed.
So should I do a seperate query, or should I leave it like that, or...?
Take a look at my answer here - you could take a similar query and use MySQL events (see here) to add rows to an aggregation table on an hourly basis - say at 5 minutes past the hour, perform a query for the previous hour's clicks and hits - that way you'd only be querying an hour at a time and I presume that the performance would be OK for a small subset of your results. Since it's logging you're doing, any logged data isn't going to change, so querying 1 hour at a time makes sense - i.e. (pseudocode) 

SELECT HOUR&lt;my_time_field&gt; AS Hour, &lt;my_aggregates&gt; 
FROM &lt;my_table&gt; 
WHERE MyTime 
BETWEEN (Now - 65mins) AND (Now-5mins);
GROUP BY Hour


Something like that might be a solution to your issue?