I have results like this

[![enter image description here](https://i.stack.imgur.com/OS7Fv.png)](https://i.stack.imgur.com/OS7Fv.png)

I need to get the latest race of each jockey (First getting the max date of the Race, and then the Max Race number). The results should look something like this:

[![enter image description here](https://i.stack.imgur.com/ZDHXY.png)](https://i.stack.imgur.com/ZDHXY.png)

Note: The database is very huge. The query should be very fast.