I know there isn't necessarily a clear cut between these two like there is between Memcached an DB/Filesystem, but I'm wondering what conditions would lead to filesystem being faster than DB caching. And, conversely, under what conditions would DB caching be faster than filesystem?
Asked
Active
Viewed 1,291 times
1 Answers
11
Filesystems are always faster than databases. Databases have overheads like locking, shard buffers, SQL parsing, query planning, etc., etc.
Ultimately, the database lives on the filesystem. A database is filesystem plus overheads.

S.Lott
- 384,516
- 81
- 508
- 779
-
good point, although I would add that for most purposes, there will likely be no measurable difference in the speed of as DB can likely serve from memory and good OS have file cache in memory. So, before you decide on one or the other, you need to determine whether the caching system is really the bottleneck in your app. – Lie Ryan Sep 09 '11 at 20:54
-
2@Lie Ryan: Measure before optimizing. Good advice. – S.Lott Sep 09 '11 at 21:06