Extract common query to a constant.

Perf ref: https://gist.github.com/vipulnsward/8209749201dfdd678c97
Merge pull request #11329 from vipulnsward/cache_one

Extract common query to a constant.