Home > Back-end > Questions about the efficiency of query user relationship
Questions about the efficiency of query user relationship
Time:12-05
I a rookie, there is now a requirement is: There is a user table is the main table t_user There are a lot of the relationship between the users table, such as between users have any attention t_follow table, is there any access t_visit table and so on, probably more than a dozen states, Then I now as a user, pull 30 users user information, and at the same time according to t_follow, t_visit exterior-interior relationship between data acquisition users such as compared to my state,
Now my practice is to pull out 30 users first, and then in the service layer according to the relationship between each corresponding data table, and then fill in the model, as a result of such processing interface can be slow, probably close to 1 s can be processed, a great god can give a optimization method or way of thinking?
Thank you,
CodePudding user response:
Can watch LianZha more, as the main table t_user, through the join on connecting the rest of the child table, and find out the corresponding field,
CodePudding user response:
Above said with a left join then indexed, basically all soon