mysql optimize group by having count
I think that your type key is the main problem for you ! as you have it set to the max index size in mysql ! 
 Try to see the real need of those 255(767 byte index) that is big for a table with that many rows. 
 And check the distinct values in this column 'type' maybe a partition can be used in order to get rid of unnecessary reads.