Few, Complex OR Many, Simple MySQL Queries?
Im working on a onlineshop with php.
I work with the mvc model and I divide each small part of my application in: model view controller and service ( service is there for the query ).
So for example I would have a Item cart which is divided in discription and price...
For each of them I would have a seperate query, for example the discription: 'SELECT discription OF ... WHERE ...'
So my questin is:
Is there any downside ( like a worse performance ) if I use many simple MySQL queries instead of one complex query?
Typically it is favorable to minimize the number of queries your application needs to execute. The reason for this is that each separate query requires a round trip to and from the database, which takes time and resources.
You did not include any actual queries, but most likely you would want to lean towards using the single complex query versus achieving the same with several queries.
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?