Reputation: 16900
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?
Upvotes: 5
Views: 138
Reputation: 96434
That is a lot of joins. It's hard to say without seeing your schema, but I have seen cases where people have gone nuts making a schema overcomplicated. I remember one application I worked on where every address and phone number in the system was treated as an entity, and queries frequently involved joins of over a dozen tables. You should be careful when making a schema to distinguish between those things you care about individually tracking and everything else, otherwise you can end up with needless complexity.
Upvotes: 1
Reputation: 1780
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 :)
Upvotes: 2
Reputation: 12904
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.
Upvotes: 1