Quote:
|
Originally Posted by r937
4. reconsider why you are doing all those joins ...
|
Don't be afraid to use
more than one query to get your answer. The old tried-and-true method of using temporary tables still works great. When the query is complex and involves many tables, "sometimes the optimizer comes up with a good plan, and sometimes it doesn't."
The risk that you (conceptually) run into is anything that smacks of a so-called "cartesian product" operation: one that joins everything with everything. The more tables you have in a query, the more possible combinations you have, "all at once."
It looks like you are using those
inner joins to locate all the models for which the other types of information are all known. If this is a frequent requirement, Logical-fields either in the models-table or elsewhere might be indicated, to show what kinds of information are available about this model.
(Sure, database-purists would argue with me on that one, but performance is a valid issue and no database exists in a vacuum.)