When the content of a certain field in the database table is large

Table of contents

Causes of impact

When the content of a certain field is relatively large, the query will be slow. The specific reasons are as follows

  1. Increased disk IO cost : A page block is the basic storage unit of data in a database, and usually the size of a page block is 16KB. If the queried data is distributed on different page blocks, the database needs to perform multiple disk IOs to obtain all the data, which will increase IO costs and query response time.
  2. Increased network transmission overhead : If the database is distributed on multiple nodes, the queried data may need to be transmitted to the query node through the network. If the data is distributed on different page blocks, multiple network transmissions will be required to obtain all the data, which will increase Network transmission overhead and query latency.
  3. Degraded query performance : Due to the need for multiple disk IO or network transfers, the performance of queries may degrade. Especially when the query needs to access a large amount of scattered data, this effect will be more significant.
  4. Reduced caching effect : Databases often use caching to improve query performance, such as memory caching to store hot data. If the queried data is distributed on different page blocks, the effect of caching may be reduced, because each page block needs to be read from the disk or network, and the advantages of caching cannot be fully utilized.

InnoDB's 16KB page block size is a design decision that provides better performance and space utilization in many cases. Larger page blocks can accommodate more data, reduce the number of I/O operations, and improve data access efficiency. In addition, larger page blocks can also reduce the level of the B+ tree in index operations, speeding up the data search process.

It should be noted that the page block size has a certain impact on database performance and storage space. Larger page blocks can improve data reading performance, but will cause a waste of space for the storage of small records , because even if only a small part of the record is occupied, the space of the entire page block will be allocated. For some specific workloads and application scenarios, you may need to consider adjusting the page block size to better match the storage requirements of the data.

MySQL allows custom page block sizes at compile time, but this needs to be modified when recompiling and installing MySQL. In general, using the default page block size of 16KB is a good choice and suitable for most application scenarios.


Guess you like

Origin blog.csdn.net/giveupgivedown/article/details/132503803