Centralize SQL queries for partial caching into a single query