Home  >  Article  >  Backend Development  >  Why are WordPress's three Term tables designed this way?

Why are WordPress's three Term tables designed this way?

WBOY
WBOYOriginal
2016-08-04 09:20:531097browse

Why are WordPress’s three Term tables designed like this? Can’t wp_terms and wp_term_taxonomy be merged into one table? What are the benefits of this design? The query has to be checked multiple times.

wp_terms

<code>term_id:分类ID
name:分类名
slug:缩略名
term_group:未知</code>

wp_term_relationships

<code>object_id:对应文章ID/链接ID
term_taxonomy_id:对应分类方法ID
term_order:排序</code>

wp_term_taxonomy

<code>term_taxonomy_id:分类方法ID
term_id:
taxonomy:分类方法(category/post_tag)
description:未知
parent:所属父分类方法ID
count:文章数统计</code>

Reply content:

Why are WordPress’s three Term tables designed like this? Can’t wp_terms and wp_term_taxonomy be merged into one table? What are the benefits of this design? The query has to be checked multiple times.

wp_terms

<code>term_id:分类ID
name:分类名
slug:缩略名
term_group:未知</code>

wp_term_relationships

<code>object_id:对应文章ID/链接ID
term_taxonomy_id:对应分类方法ID
term_order:排序</code>

wp_term_taxonomy

<code>term_taxonomy_id:分类方法ID
term_id:
taxonomy:分类方法(category/post_tag)
description:未知
parent:所属父分类方法ID
count:文章数统计</code>

wp_term_taxonomy is a tree-level structure, so term_taxonomy_id is necessary,
and wp_terms is a classification table. Classification things will often use the id, and the id cannot be omitted, so we built two and a half tables

That’s true. When I came into contact with the e-mall project, I couldn't stand the form of the project. It could be made into one but it had to be split into many single forms. What I do now is to write a view based on this and combine the forms as a new table to use, which is much more convenient. I hope it will be helpful to you~

I really don’t understand why these popular website building programs use so many data tables. If I designed it myself, all data tables would not exceed 15.
Of course, if the amount of data in a single table is too large, it will be very frustrating for MySQL.
You should ask the WordPress people about this.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn