I use the following query to get the highest id of a set of rows, but since in some cases, there are tens of thousands or hundreds of thousands of rows in the set, making the query very inefficient. Is there a way to accomplish the same result in a more efficient way?
SELECT MAX(id) FROM table WHERE groupID = '12345'