KenBrace Posted February 24, 2015 Share Posted February 24, 2015 What do you think is the feasible limit of database queries before it becomes too much? In my experience you want to keep your query count below 20 if possible. Otherwise you'll start noticing loss in speed. I'm not sure about max though. Quote Link to comment Share on other sites More sharing options...
Administrators Nathan Posted February 27, 2015 Administrators Share Posted February 27, 2015 I've seen 40+ on pages that still load quickly. I don't think the number of queries matter, but how many rows are in the tables and how efficient it's written. KenBrace 1 Quote Link to comment Share on other sites More sharing options...
KenBrace Posted February 27, 2015 Author Share Posted February 27, 2015 I've seen 40+ on pages that still load quickly. I don't think the number of queries matter, but how many rows are in the tables and how efficient it's written. Maybe so. I remember one mistake that I used to always make when writing database query script is that I always wrote "SELECT * FROM" instead of selecting only the fields needed. You should only select all fields when you're going to use all or almost all of the fields in the table. Quote Link to comment Share on other sites More sharing options...
Administrators Nathan Posted February 27, 2015 Administrators Share Posted February 27, 2015 Maybe so. I remember one mistake that I used to always make when writing database query script is that I always wrote "SELECT * FROM" instead of selecting only the fields needed. You should only select all fields when you're going to use all or almost all of the fields in the table. For sure. I get yelled at for this at times by my boss that codes some. He spends a lot of time with PHP errors only to find it's because he called a field in PHP that was not defined in a SQL query I wrote I told him for efficiency we need to do this, but he always select *'s. Quote Link to comment Share on other sites More sharing options...
KenBrace Posted February 27, 2015 Author Share Posted February 27, 2015 For sure. I get yelled at for this at times by my boss that codes some. He spends a lot of time with PHP errors only to find it's because he called a field in PHP that was not defined in a SQL query I wrote I told him for efficiency we need to do this, but he always select *'s. Doing a SELECT * FROM is definitely easier because there is less room for error but it isn't worth the resources you are sacrificing. In my opinion it is definitely worth your time and effort to make the queries as efficient as possible; even if it means a few more errors to deal with every now and then. It pays off after the project is complete. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.