MySQL series (twelve) - How to design a relational database (basic idea)

  Design a relational database, which is designed RDBMS (Relational Database Management System), this issue is the division of RDBMS test each module,

And knowledge of the database structure. As long as describes the basic module design ideas can, of course, if you can speak relatively small better.

The basic mechanism:

File storage system:

  The database is important for data storage, the equivalent of the OS file system, data persistence, for example, stored to disk

Program example:

  With the storage system is definitely not enough, we need to use these data, this time we should rely on the program

Storage Management:

  Mapping the logical structure of a physical structure, we need to read the data related to the program memory, a data processing process in the hard disk is not possible, because both the mechanical hard drive or solid state drive with respect to the memory

The processing speed of a difference of more than one order of magnitude. Block or page data stored generally used, in MySQL we often mentions the use of Page data stored to a page as the basic unit.

Caching mechanisms:

  When the data are loaded into the page memory in order to improve efficiency, it is necessary caching mechanism. When the query is the primary key data 10, page loaded into memory, will contain similar data around, they are accessed

The probability is also great.

  Of course, also consider cache invalidation, update strategy

SQL Analysis:

  We need to provide users with DL, containing DDL, DML, DCL, used to manipulate data. SQL and SQL parsing module will resolve into machine code that allows the operating system to identify, SQL can be resolved after the

It is cached

Log Management:

  For the operation of the database needs to be recorded, this time we need log management module. Such as MySQL binary log, common log, slow check logs

The division of authority:

  The division of authority is also important, DBA privileges can not and your rights, like it, then you do not want a God?

Disaster recovery mechanisms:

  Once the application exception occurs, how to recover, restore and to what extent, this is disaster recovery

Index Management:

  The importance of the relational database index is self-evident, I remember the beginning of the structure of the database, SQL optimization mentioned will think of indexed 23333.

  You need to consider what kind of data structure of the index used binary search tree? Red-black tree? B-tree? B + tree? Hash?

lock:

   Lock module is also very important to ensure the safety of concurrent operation, etc.

to sum up:

  This article is just a basic idea of ​​relational database design and our usual projects are the same, are included different modules, the basic idea to answer it, the interviewer will be based on these

Different modules continue to ask to go, binlog, slow queries, SQL optimization, index, row locks, table locks, etc.

 

Guess you like

Origin www.cnblogs.com/huigelaile/p/11334988.html