WordPress.org

Ready to get started?Download WordPress

Forums

wp_terms and wp_term_taxonomy - why this separation? (2 posts)

  1. mainpart
    Member
    Posted 1 year ago #

    Hello.
    I wonder why wordpress DB design require separation into two tables for terms description and relationships with taxonomies if each term row in wp_terms has exactly one row in term_taxonomies? There are no terms that has multiple intersects with term_taxonomies - each term is a member of one taxonomy, terms with equals names should be separately assigned to taxonomies even they are the same taxonomy. so two tables could easily be joined into one and wordpress engine could use term_relationships to determine corellation between post and it's taxonomy coordinates. The only reason for current DB design (for my opinion) is that term_taxonomy table has more lightweight design (since it does not hold 2 varchar(200) fields) and could be joined a little more faster (in inner mysql engine)

    Each term belongs to taxonomy - am i right? There no terms beyond taxonomy. So i wonder why current DB design build this way so it duplicate it's structure in wp_terms/wp_term_taxonomy

  2. Makarek
    Member
    Posted 1 year ago #

    I also looking for how to explain it. And that what I found.
    In WordPress term can be category and tag. That why they use 3 tables.

    If you want create similar category and tag:
    1. You add ONE record to table 'wp_terms', example:
    term_id=1, name=Jewelry
    2. You add TWO records to table 'wp_term_taxonomy':
    term_id=1, taxonomy=category
    term_id=1, taxonomy=tag

    And you can use term Jewelry as category and as tag.

Topic Closed

This topic has been closed to new replies.

About this Topic