Database Optimization Review (Chapter 1)

Chapter One:

Database performance optimization

  1. Optimization of computer systems (hardware equalization)
  2. Optimization of SQL statements (by adding indexes and setting parameters to make MySQL's execution plan better)
  3. Architecture optimization ( the most effective , more reads and less writes can be designed to separate reads and writes)

database development stage

Manual management stage —> file system stage —> database development stage

Classification of database

relational database

non-relational database

Relational non-relational
advantage 1. Both use the table structure for easy maintenance; 2. The SQL language is common and easy to use for complex operations; 3. Support SQL, which can be used for very complex queries between one table and multiple tables . 1. Flexible format : the format of stored data can be in the form of key, value, document, picture, etc.; 2. Fast speed ; 3. High scalability ; 4. Low cost : nosql database deployment is simple
shortcoming 1. Poor read and write performance ; 2. Fixed table structure, less flexibility ; 3. High concurrent read and write requirements, hard disk I/O is a big bottleneck. 1. Does not provide sql support , and the cost of learning and using is relatively high; 2. No transaction processing ; 3. The data structure is relatively complicated, and the complex query is slightly lacking.

Mainstream version and branch

Version:

A milestone version, MySQL 5.0, was released in 2005. Support for cursors, stored procedures, triggers, views, and transactions was added in 5.0.

In 2008, it was acquired by Sun for US$1 billion. In 2009, Oracle acquired Sun.

In 2010, MySQL 5.5 was released, and the InnoDB storage engine became the default storage engine of MySQL.

In 2015, MySQL 5.7GA was released, which is the latest stable version branch so far.

branch:

Percona Server , which improves performance and manageability based on the InnoDB storage engine , and finally forms an enhanced version of the XtraDB engine.

MariaDB and MySQL have the potential risk of being closed source , so the community uses branching to avoid this risk, using the XtraDB engine.

The processing of a query statement in the database

MySQL logical architecture

The overall MySQL logical architecture is divided into three layers:

  1. The first layer is the client layer (JDBC database connection pool those things)
  2. The second layer is the SQL layer
  3. The third layer is the storage engine layer

  1. The SQL layer is the core part of MySQL and is usually called the core service layer.

    Management Services and Tools Component : System management and control tools manage databases from backup and recovery security, replication, clustering, administration, configuration, migration, and metadata.

    SQL interface component : perform operations and management of DML, DDL, stored procedures, views, triggers, etc.; user SQL command interface.

    Query Analyzer component : Parses and validates SQL commands.

    Query optimizer component : optimize SQL statement query.

    Cache and Buffer : This caching mechanism is composed of a series of small caches. Such as table cache, record cache, key cache, permission cache, etc.

  2. Storage engine layer :

    MySQL's storage engine is pluggable.

Guess you like

Origin blog.csdn.net/weixin_45930241/article/details/123523655