Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How many joins per functionality in real world application?

Tags:

rdbms

The queries that i create frequently have 7-8 joins to retrieve data. Are these many joins normal in a real database application or is my database design poor? I am curious because if on each request database has to do so much work, then won't it die if few thousands of client connect?

like image 659
TCM Avatar asked Oct 15 '22 03:10

TCM


2 Answers

In my opinion it's inevitable in some cases, the key is to have the correct indexes for the queries you're doing. With a deep object graph in ORM, or perhaps one with joined subclasses, it'd be easy to go over the 7-8 joins you talk of. I'm keen to hear what everyone else has to say about it :)

like image 102
James Avatar answered Oct 18 '22 13:10

James


Its not possible to draw a Conclusion in this regard without the Application Logic Details. If your Application Logic leads you to unavoidable joins to maintain the integrity Its not a Problem, and Your Database Platform must handle it.

like image 30
Neel Basu Avatar answered Oct 18 '22 12:10

Neel Basu