An index on (varchar_field1, varchar_field2, date_field)will be most useful. The database can use the first index field to suggest where, the second to group by, and the third to calculate the maximum date. He can complete the entire query only with this index, without looking at the rows in the table.
source
share