Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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…

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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?

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading