Comparison of file systems and databases
This paper mainly from the point of view of stand-alone system, compared with common file system and database technology. there should be a lot of missing places when you think about where you write.
Common:
- belong to the system software or the underlying software
- are used to store and access data.
- Has a long history of research and development
- have mature standards or specifications. This facilitates the development of portable programs and is not conducive to the development of innovative systems, especially distributed systems.
- There is a lot of commonality in the implementation technology.
- Mostly using a lower-level language such as C + +
- Need to ensure consistency of data, special, varying levels of support services
- There are concepts such as block or page or allocation unit or extent
- Uses concepts and algorithms such as buffer cache, LRU, and Group commit
- Have to do IO optimization for various loads
Different points:
- Database support for transactions is much stronger, the file system can only guarantee the consistency of metadata
- The database has different levels of consistency and is reflected in the form of isolation levels
- The database can have redo and undo logs, and the file system generally uses only redo
- The database transaction can be very long, the file system transaction is very short
- The transaction of the database cannot be determined beforehand, it is user input, the transaction of the file system can be determined beforehand, the kind is clear
- The database is implemented by the user state, and the file system is generally implemented by the kernel state. As a result, the former is easier to do across OS platforms
- The access interface for a database is usually a non-procedural SQL language, and the file system is an API. The mainstream criteria for both are SQL and POSIX
- The database can detect deadlocks, and the file system needs to avoid deadlocks.
Contact point:
- Database systems often rely on file systems as their lowest-level storage, and may also implement some file system functions
- File systems can be specifically optimized for this particular application of the database.
- The file system can be used as a simple database (e.g. VSAM), and the database can also expose NFS (for example, Oracle)
- The file system may use some simple database functions (such as using symbolic links as kv, implementing simple DB functions, or directly with a small DBMS)
Comparison of file systems and databases