Home  >  Article  >  Database  >  How to implement join buffer in MySQL

How to implement join buffer in MySQL

王林
王林forward
2023-05-27 12:55:06913browse

Explanation

1. In MySQL's processing of join operations, join buffer is an important concept.

2. It is an important optimization method for table join in MySQL. Although the implementation of this concept is not complicated, it is an important method to realize MySQL join connection optimization, which can greatly improve the efficiency of join query when connecting.

Example

Table name      Type
t1              range
t2              ref
t3              ALL
The join is then done as follows:
 
- While rows in t1 matching range
 - Read through all rows in t2 according to reference key
  - Store used fields from t1, t2 in cache
  - If cache is full
    - Read through all rows in t3
      - Compare t3 row against all t1, t2 combinations in cache
        - If row satisfies join condition, send it to client
    - Empty cache
 
- Read through all rows in t3
 - Compare t3 row against all stored t1, t2 combinations in cache
   - If row satisfies join condition, send it to client

The above is the detailed content of How to implement join buffer in MySQL. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete