Is there a performance difference between using mysql_result and mysql_array_assoc to loop through a large SQL select result?

Accepted Answer

From the mysql_result() manual page:

When working on large result sets, you should consider using one of the functions that fetch an entire row (specified below). As these functions return the contents of multiple cells in one function call, they're MUCH quicker than mysql_result(). Also, note that specifying a numeric offset for the field argument is much quicker than specifying a fieldname or tablename.fieldname argument.

So it seems that mysql_array_assoc(), one of the functions that quote refers to, is going to be your best bet.

Written by zombat
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the community.
It is licensed under cc-wiki