update query to use  rather than  to handle identical commits and timestamp