Is it true that database management systems typica

2019-05-02 03:49发布

问题:

Is my general understanding that a typical database management systems bypass file system correct? I understand that they manage their own space on disk and they write actual data and index systems like B tree directly into disk blocks bypassing any intermediate help from file system.

This assumes that root would provide the database user permission to directly read and write from disk blocks. In Linux, this is still easier as disk can be treated as a file.

Any pointer to real case studies will be greatly appreciated.

回答1:

Most rely on the underlying file system for WAL etc: basically they outsource it to the OS.

Some DBMS support (Oracle, MySQL) "raw" partitions, but it isn't typical. Too much hassle (see this chat about Postgres) because you still need WAL etc on your raw partition.



回答2:

DBMSs do not bypass filesystem. If this was the case, the table names would not be case-insensitive under Windows and case-sensitive under Linux (in MySQL). What they do is to allocate large space on the file system (by the way, the data is still visible as a file / set of files in the underlying operating system) and manage internal data structure. This lower the fragmentation and the overall overhead. In a similar way cache systems works - Varnish allocates entire memory it needs with a single call to operating system, then maitains internal data structure.



回答3:

Not completely, mysql asks for data directory and stores the data in a specific file format where it tries to optimize the reads,writes from a file and also stores indexes there.

More over it can also differ from one storage engine to another. Mongodb uses memory mapped files for disk IO Looking forward for more discussion here.