Now I have two watches
A user table, uid,username,pwd,email … and other fields
A Zhang wenzhang table, aid,subject,content,time,uid … and other fields
The first 20 data containing fields to obtain the latest articles are: uid, username, email, aid, subject, content, time
Now there are a few questions:
1. Which of the following two ways is faster? I think it is the second
The first one: php gets the data, directly loops, takes out uid each time, and then queries the user table information.
The second kind: direct left outreach query
2. How to query tables when tables are divided
If the user table is divided into five tables, user1,user2,user3,user4,user5, if each table has 100,000 user data, if you use linked list query again, how should you do it fastest? if you say the latest article is 20, the author information of the first 10 articles is user1, and the author information of the last 10 articles is user4, how should you query linked list? Of course, the author information of the article is not known in advance in that table, and is mainly obtained according to uid records of each article.