Design of Multi-tier Classification Database

  mysql, question

Note: Projects need to be classified into multiple categories by the same post, such as:

  1. China/Beijing/Chaoyang/Wangjing
  2. School/University/Peking University/Faculty of Arts
  3. ……..

The project will do many multi-level classifications for the same page (or a post is published under multiple classifications). how to design the database? the following design queries are too slow. are there any alternative methods

-Meta-classification table
 create table tag (
 tagid mediumint(8) unsigned not null auto_increment,
 tag varchar(12) not null default '',
 parentid mediumint(8) unsigned not null default '0',
 primary key (tagid),
 key (parentid),
 key (tag)
 ) engine=myisam;
 
 -Classification and post Relationship Table
 create table post_tag (
 id int(10) unsigned not null auto_increment,
 tagid mediumint(8) unsigned not null default '0',
 postid int(10) unsigned not null default '0',
 tagline varchar(100) not null default '',
 primary key (id),
 key (tagid),
 key (postid)
 ) engine=myisam;

Inquire about Chaoyang University?

This is another problem … Can we not use relational data, inventory hierarchy data, or not?
If you really want to use RDBMS, make a tag->entity one-to-many table, then add an index to the tag, and find your own way to solve the problems of data redundancy and consistency.

Give MySQL a break.