Now we can look at what components are inside the database. A database is a collection of information that is easy to access and modify, and in fact a simple set of files can be done. The simplest database SQLite consists of a set of simple files and is a set of well-designed sets of files that allow you to:
- Ensure the security and consistency of data through transaction;
- Real-time, massive data can also guarantee fast processing of data.
Typically, a component view of a data is as follows:
Before writing this section, I read a lot of books and papers, each with its own unique way of describing the database. So don't tangle with how I organize the database, or how I name these components, because I've been thinking about it for a long while to fit this article. Different components are not important, it is important to divide a database into multiple components and the connections between them.
Core components
- Process Manager: Many databases contain a managed process or thread pool. and to support nanoseconds, many databases use their own threads rather than operating system threads.
- Network manager: Network IO is an important issue, especially for distributed databases, so some databases have their own network manager.
- File System Manager: Disk IO is the first bottleneck in a database, so it is extremely important to use a manager to perfectly handle the operating system's file system, or even replace it.
- Memory Manager: In order to avoid the bottleneck of disk IO, a large amount of memory is necessary. But if you're dealing with a lot of memory, you need an efficient manager, especially if you have a lot of concurrent query requests that use memory.
- Security Manager: Used to manage authentication and user rights.
- Client Manager: Used to manage client connections.
- ...
Tools
- Backup manager: Protect and recover data;
- Recovery Manager: Ensure the consistency of data status and restart normally after downtime;
- Monitoring manager: Records the behavior of the database and provides tools to monitor;
- Database Manager: Stores metadata (like the name and structure of a table) and provides tools to manage databases, Schemas, tablespace ...
- ...
Query Management
- Query parser: Check whether the query statement is valid;
- Query rewriting: pre-optimized queries;
- Query optimizer: Optimizing queries;
- Query executor: Compile and execute query statement;
Data management
- Transaction manager: Handling transactions;
- Cache Manager: Before reading or writing from disk, put the data into memory first;
- Data Access Manager: Access to data on disk.
In the remainder of this article, I'll focus on how a database manages a query:
- Client Management
- Query Management
- Data management (including data recovery)
In the next section we first introduce client management.
How does a "serial" relational database work? (7)-Database Schema View