MySQL JOIN Abuse? How bad can it get?

后端 未结 5 1114
星月不相逢
星月不相逢 2021-01-31 12:36

I\'ve been reading a lot about Relational Databases using many JOIN statements on every SELECT. However, I\'ve been wondering if there\'s any performance problem on the long run

5条回答
  •  灰色年华
    2021-01-31 13:23

    Fear not joining. The relational model is strong and you should employ it. Someone always discussed N+1, but also consider--in your context--joining against users often for security purposes too as the query can additionally mandate user existence, status, session correctness, and field expectation.

    Many large sites go so far as to have session table and http request table for every request, always joined against each other for the page queries. Benefit is that parameters are always matched to sessions, sessions to proper users, user status always checked, &c &c but moreso that it allows for some interesting scale-out benefits.

    Long story, do it wisely, but don't skimp on joining.

提交回复
热议问题