asmith Posted October 7, 2011 Share Posted October 7, 2011 Hello, I've been reviewing my codes/queries. I found that If I split a query (with 2 left joins) into 3 queries, the sum of the 3 queries times is actually less than the main query. While learning MySQL I always went with "Less queries, More performance", but this case made me wonder which way to choose. Is it easier for MySQL/CPU/Server to handle 3 queries that takes less time or one query taking a bit more? Thanks for your time. Quote Link to comment https://forums.phpfreaks.com/topic/248639-time-vs-number/ Share on other sites More sharing options...
fenway Posted October 7, 2011 Share Posted October 7, 2011 Since you haven't shown us anything, it's impossible to say. Quote Link to comment https://forums.phpfreaks.com/topic/248639-time-vs-number/#findComment-1276914 Share on other sites More sharing options...
The Little Guy Posted October 7, 2011 Share Posted October 7, 2011 it all depends on the tables, such as: - Size - Structure - and other factors Quote Link to comment https://forums.phpfreaks.com/topic/248639-time-vs-number/#findComment-1277015 Share on other sites More sharing options...
awjudd Posted October 8, 2011 Share Posted October 8, 2011 Have you indexed your tables? Have you run EXPLAIN on your queries to see how it is actually being run through the query engine? ~juddster Quote Link to comment https://forums.phpfreaks.com/topic/248639-time-vs-number/#findComment-1277153 Share on other sites More sharing options...
fenway Posted October 9, 2011 Share Posted October 9, 2011 And have you posted that EXPLAIN for us to review? Quote Link to comment https://forums.phpfreaks.com/topic/248639-time-vs-number/#findComment-1277489 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.