Writing performant code is absolutely critical, especially at the enterprise level. There are a number of strategies and best practices we must employ to ensure our code is optimized for high-traffic situations. When querying the database in WordPress, you should generally use a WP_Query object….
Source: https://10up.github.io/Engineering-Best-Practices/php/