ats: Intra-query result caching

Prevents a query from pulling the same data more than once from the server.