I need to know this information please, I use the file() function in PHP which reads an entire file into an array; that file contains serialized objects that I unserialize and use.
On the other hand, I have the option of storing information in MySQL and retrieving it using a query.
Knowing that this operation is expected to be done millions of times a day, is it better for PHP to read and unserialize data from file or from database? I have no statistics in hand :(
Thank you in advance.
Memory is going to be faster, and generally mysql will cache common queries in memory (unless the query cache is disabled for some reason). If the server is remote network latency may need to be accounted for.
Now, there is a better way to do this. Use APC or a local memcached server to store this information. This is your best option if it doesn't change or changes infrequently.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With