TEENFRONT Posted March 6, 2010 Share Posted March 6, 2010 Hello, Just a quick one Whats quickest? my table has about 30 columns, and i only need 2-3 columns in my results, is selecting everything (*) quicker than just selecting 2-3 colums? 1-2 of the colums are indexed. I own and large site so little things like this might help with our serverload and memory usage. Cheers! Quote Link to comment https://forums.phpfreaks.com/topic/194369-select-or-select-col1-col2/ Share on other sites More sharing options...
Zane Posted March 6, 2010 Share Posted March 6, 2010 Whats quickest cheapest? Going to the grocery store and getting EVERY food item possible.. or Going to the grocery store and getting exactly what you need/want/came there for. Quote Link to comment https://forums.phpfreaks.com/topic/194369-select-or-select-col1-col2/#findComment-1022461 Share on other sites More sharing options...
TEENFRONT Posted March 6, 2010 Author Share Posted March 6, 2010 well i thought that, but i heard mysql has to search for the each columns if you do them individually, but if you use *, it knows where everything is already? make sense? Thats why i asked though lol. Quote Link to comment https://forums.phpfreaks.com/topic/194369-select-or-select-col1-col2/#findComment-1022463 Share on other sites More sharing options...
Zane Posted March 6, 2010 Share Posted March 6, 2010 well.. I'm no MySQL expert, but I'm sure the difference in speed between the two is no more than a few thousand milliseconds... if not more. It wouldn't be enough to notice... depending on your server's CPU speed. Ideally though, it's best to select only the columns you need so that when you're debugging you know exactly what columns you're working with instead of going back and forth between phpmyadmin and your script. Quote Link to comment https://forums.phpfreaks.com/topic/194369-select-or-select-col1-col2/#findComment-1022464 Share on other sites More sharing options...
Mchl Posted March 6, 2010 Share Posted March 6, 2010 well i thought that, but i heard mysql has to search for the each columns if you do them individually, but if you use *, it knows where everything is already? make sense? Not. The less data you fetch, the quicker you will get it. Quote Link to comment https://forums.phpfreaks.com/topic/194369-select-or-select-col1-col2/#findComment-1022480 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.