MySQL: Indexing by column which is also a part of a compound primary keys and
visits for a page for a period of time:  INDEX(page_id, hour)

visits for a period of time:  INDEX(hour)

Your primary key, plus these, are not redundant; have them all.

Recommend you keep sum_time, not avg_time, then compute the avg as SUM(sum_time) / SUM(visits).  (The average of averages is not mathematically correct.)