SM wrote:
Quote:
i'm always trying to optimize my code even if the one in place works
ok...
I've read, a long time ago, that to make it more efficient when
looping the data from MySQL, the fastest you open the connection and
close the connection to the database, the better it is.
So, i was wondering, what is better: Open the database, put all data
in an array, close the database and use the array to process data OR
open the database, process the data and close the database.
Any ideas what method is better? Maybe both are equally more
efficient... |
Insufficient information, and every case will be different. For
instance, it can depend on the size of the dataset returned - handling
100 bytes of data will be very different from handling 100 MB of data.
But it looks like you are falling into the premature optimization trap.
Code your program for to make it easy to understand and maintain. If
you find you have a performance problem, find the cause of the problem
and fix that.
You will do much better in the long run.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex (AT) attglobal (DOT) net
==================