It appears you have not registered with our community. To register please click here ...

Author Topic: Which is Faster?  (Read 1373 times)

zelo

  • Super Moderator
  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 264
  • Karma: +10/-0
    • ICQ Messenger - 233717
    • MSN Messenger - webmaster@zelo.com
    • Yahoo Instant Messenger - zelo@yahoo.com
    • View Profile
    • http://www.zelo.com
    • Email
Which is Faster?
« on: August 18, 2005, 01:02:21 PM »
I have a site that accesses a database many different times. The way it is programmed right now is that everytime it needs information from the database (sometimes 10X on one page) it opens and then closes the database (MySQL).

Is it faster to access the database over and over or to put the data into an array and then extract what I need from that array therefore only opening the database one time...
http://www.name-stats.com

Thanks,

Zelo
http://www.zelo.com

adb22791

  • Former Moderator
  • Full Member
  • ***
  • Posts: 149
  • Karma: +10/-0
    • ICQ Messenger - 226098809
    • View Profile
    • Email
Which is Faster?
« Reply #1 on: August 18, 2005, 02:25:40 PM »
You could probably test both of them to see which one is faster.

Quote
Is it faster to access the database over and over or to put the data into an array and then extract what I need from that array therefore only opening the database one time...


I would guess that that would be faster.
-Alex

zelo

  • Super Moderator
  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 264
  • Karma: +10/-0
    • ICQ Messenger - 233717
    • MSN Messenger - webmaster@zelo.com
    • Yahoo Instant Messenger - zelo@yahoo.com
    • View Profile
    • http://www.zelo.com
    • Email
Which is Faster?
« Reply #2 on: August 18, 2005, 07:25:24 PM »
The time is so miniscule that I doubt there would be a difference if one web site was running either way... multiply that by hundreds of web sites being run on a server and then the time difference could be substantial.