Home > Article > Backend Development > MySql sub-table, how do large companies do it, how to do it efficiently, how to do joint table query between sub-tables?
A user table, fields such as uid, username, pwd, email... and
An article table with fields such as aid, subject, content, time, uid...
Get the latest 20 data fields of the article: uid, username, email, aid, subject, content, time
The first type: After php gets the data, it loops directly, takes out the uid each time, and then queries the user table information
The second type: direct left external query
Suppose the user table is divided into 5 tables, user1, user2, user3, user4, user5. If each table has 100,000 user data, if you use linked list query, what should be done fastest? If the latest article 20 Articles, the author information of the first 10 articles is in user1, and the author information of the last 10 articles is in user4. How should I query the linked list? Of course, the author information of the article is not known in advance in the table, and is mainly obtained based on the uid record of each article.
A user table, fields such as uid, username, pwd, email... and
An article table with fields such as aid, subject, content, time, uid...
Get the latest 20 data fields of the article: uid, username, email, aid, subject, content, time
The first one: After php gets the data, it loops directly, taking out the uid each time, and then querying the user table information
The second type: direct left external query
Suppose the user table is divided into 5 tables, user1, user2, user3, user4, user5. If each table has 100,000 user data, if you use linked list query, what should be done fastest? If the latest article 20 Articles, the author information of the first 10 articles is in user1, and the author information of the last 10 articles is in user4. How should I query the linked list? Of course, the author information of the article is not known in advance in the table, and is mainly obtained based on the uid record of each article.
Second type
https://segmentfault.com/q/10...