Can I use unique index in GROUP BY clause instead of column in mysql
SELECT toll, date, SUM(car), SUM(truck), SUM(bus)
    FROM shift_wise_traffic 
    GROUP BY toll, date;



The GROUP BY must have a list of columns, not an index name.
An INDEX is an optimization, not a requirement.
An INDEX may be useful for queries like this.  (No index is likely to be useful for this particular query.)
Probably this query will simply scan the entire table, sort by toll+date, sum up the values, then deliver the output.  (Or it may build an in-memory hash based on toll+date for summing.)
UNIQUE versus INDEX -- makes no difference in this context.  UNIQUE = INDEX + a constraint.  For INSERT, UNIQUE prevents duplicates.


It feels like your PRIMARY KEY is (date, shift, toll) in some order.  Is it?  If so, then changing the order to PRIMARY KEY(toll, date, shift) might make your GROUP BY run a little faster.  (But it might slow down other operations.)