Should I store emails in a DB or in a text file?

I need to store an email address from a simple form (like a newsletter) but the site load is high, I'm wondering if I want to store them in a text file (after all, write a cronjob to store them every night in the DB) or store them directly in the database?

+2


source to share


2 answers


I think storing directly in the DB would be the fastest way to do this, and it allows for a lot of flexibility later on. To write to a file you have to deal with file compatibility and locking, and I don't think the performance gains will be worth the trouble.



+6


source


Adding them to a text file will speed up work during "storage". It all depends on what you are going to use the addresses for. If you can also use them in sequential order, I would suggest a text file.



If, on the other hand, you use addresses more punctually, and if you have a database to follow, I think storing them directly in the database will be more useful.

0


source







All Articles