Which is more expensive to do in terms of resources and efficiency, File read/write operation or Database Read/Write operation
4 Answers. Show activity on this post. Database is faster.
We can see that reading data from MySQL is not always slower than reading data from pure filesystem. Especially in the case when small files are read first time, MySQL database is much faster than a pure filesystem. This is probably caused by better caching in MySQL database.
In computer science, in the field of databases, read–write conflict, also known as unrepeatable reads, is a computational anomaly associated with interleaved execution of transactions. Given a schedule S. In this example, T1 has read the original value of A, and is waiting for T2 to finish.
In information technology, a write-only memory (WOM) is a memory location or register that can be written to but not read. In addition to its literal meaning, the term may be applied to a situation when the data written by one circuit can be read only by other circuitry.
I was initially going to say database read/write, hands down, as it would include the requisite file io on top of the DB overhead, but then realized its not that simple. If you have your entire DB loaded into memory, reads would be nearly instantaneous as there's no file IO involved.
Writes would, in general, be faster too, as the DB engine doesn't have to wait for the file IO to complete before returning since they can take a "lazy write" approach.
A poorly tuned database, on the other hand, will be orders of magnitude slower than any file based IO. DB tuning matters. A lot.
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