Michdd Posted May 28, 2009 Share Posted May 28, 2009 I've read somewhere that mysql_fetch_assoc uses less memory because it doesn't generate key indexes. When fetching data from the database very often would there actually be a noticeable difference between using the two? Quote Link to comment https://forums.phpfreaks.com/topic/160007-mysql_fetch_assoc-vs-mysql_fetch_array/ Share on other sites More sharing options...
Adam Posted May 28, 2009 Share Posted May 28, 2009 Not on small queries, but when you're talking a couple of million rows there's probably going to be a difference. The greatest of the work is done fetching the data and not entering it into the array(s). 95% of the time I use mysql_fetch_assoc() simply because it makes the code more readable, but there is the odd time where you may need to use mysql_fetch_array(), just base the choice on the situation. Quote Link to comment https://forums.phpfreaks.com/topic/160007-mysql_fetch_assoc-vs-mysql_fetch_array/#findComment-844057 Share on other sites More sharing options...
Ken2k7 Posted May 28, 2009 Share Posted May 28, 2009 mysql_fetch_assoc is more likely to be faster. Quote Link to comment https://forums.phpfreaks.com/topic/160007-mysql_fetch_assoc-vs-mysql_fetch_array/#findComment-844139 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.