Every category or tag (i.e. electronics) is stored as term in wp_terms
table which is indexed with name
and slug
, and its relationship with taxonomy is stored in wp_term_taxonomy
table which is indexed as taxonomy
and term_taxonomy_id
.
I can find term_id
from wp_terms
table using name
efficiently because it is indexed with name
, but then I have to use term_id
further to find term_taxonomy_id
from wp_term_taxonomy
table, but it is indexed as taxonomy
but not term_id
, and then further I’ll use term_taxonomy_id
to find object_id
(posts) from wp_term_relationship
table.
Question is, why wp_term_taxonomy
table is not indexed with term_id
which is important in operations like finding posts related to a particular category or tag or anything else?