views:

70

answers:

2

Hi,

I need to store email address from a simple form (like a newsletter), but the website loading is high, I'm then wondering if I'd rather store them to a text file (eventually write a cronjob to store them each night to the DB), or store them directly to the DB ?

+6  A: 

I think storing directly in DB would be the fastest way to do it and it will allow for the most flexibility later on. To write in a file you need to deal with concurency and file locking and I don't think the performance gain would be worth the trouble.

rslite
A: 

Appending them to a text file will speed up things during the 'store' fase. It all depends however what you are going to use the adresses for. If you can use them in a sequential way too, I would suggest the text file.

If, on the other hand, you will use the adresses in a more punctual way, and if you have a performant database at hand, I think storing them directly in the database will be more usefull.

Filip P.