Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Is Relationship increase load on mySql

If I used relation in model like belongsTo, hasMany etc. in model and use object to get matched data from another table. Will it increase load on mySql Server, Since it call single query for each result from resultset

But Suppose I have multiple Hats and each Hats have ribbons. So If I queried for hats only then will it queried for each ribbons inside each hats when I used object of ribbons? e.g. I have 10 hats and each 10 hats have 2 ribbons, and I m using ribbons object each time while diplay. Then will it call 1 query for hats and 20 queries for ribbons. So will it not increase request to database. So it is preferrable method?


You can write join query, so that you have to execute only one query. You will get your hat and its ribbons in one query