November 4, 2019
Let’s take a closer look on the SQL queries that are executed when we are listing posts with WP_Query. Is there any difference in performance between querying posts by custom fields vs. by taxonomy’s terms? It is oftentimes the case that when we need to attach an extra information to the post, we would store it as a custom field, e.g. using the Advanced Custom Fields plugin. But are there any situations in which it would be better to store it as a term in a custom taxonomy? Let’s dive into WordPress database schema, common SQL queries that are fetching the posts and let’s try to understand which factors have the biggest influence on query performance.