Single table MySQL data not more than five million lines? Really?

  Today to discuss an interesting topic:? MySQL single table data reaches only need to consider how many sub-library sub-table some say 20 million lines, some said five million lines. So, how much value do you think this is appropriate it?

  

 

  Internet technology in China has been widely circulated circle with such a statement: MySQL single table data is greater than 20 million lines, the performance will be significantly reduced. In fact, this rumor reportedly originated in Baidu. The specific circumstances of something like this, when testing the performance of MySQL DBA year found that when the amount of a single table in the order of 20 million lines, a sharp decline in the performance of SQL operations, therefore, the conclusions from this. Then he said to other company Baidu engineers flowing into the industry, but also brought this information, so it spread such a statement in the industry.

  Still later, Ali Baba "Java Development Manual" put forward a single table rows over 5 million lines or single-table capacity of more than 2GB, it is recommended sub-library sub-table. In this regard, there is support gold iron law Ali, so many people when designing large data storage, and more will be used as criteria, a sub-table operation.

  So, how much value do you think this is appropriate? Why not three million lines, or 800 million lines, but five million lines? You might say this is probably the best value of the real Ali, right? Well, the problem again , this is how to assess the value out of it? wait a moment, you think a little while.

  

 

  In fact, irrespective of the value and the actual number of records, and the MySQL configuration and the machine's hardware related. Because, MySQL in order to improve the performance index, the table will be loaded into memory. Under InnoDB buffer size is sufficient, it can complete a fully loaded into memory, the query will not have a problem. However, when the single-table SQL database after the order reaches a certain upper limit, resulting in memory can not store its index so that a query will produce disk IO, resulting in performance degradation. Of course, there are specific design of this table structure related issues are leading to memory limitations. Here, additional hardware configuration, performance may lead to an immediate improvement Kazakhstan.

  Well, I view for the sub-library sub-table that requires a combination of actual demand, the design should not be excessive, in the beginning of the project and does not use sub-library sub-table design, but as the business grows, without being able to continue optimization, then consider the points table with a sub-library improve system performance. In this regard, Ali Baba "Java Development Manual" adds: If the amount of data expected after three years failed to reach this level, you do not sub-library sub-table when creating tables. So, back to the initial question, how much value do you think this is appropriate? My suggestion is that a comprehensive assessment of the situation according to their own machine, if the heart is not standard, then the temporary 500 million lines as a unified standard, relatively For a more eclectic regarded value.

Guess you like

Origin blog.csdn.net/qianfeng_dashuju/article/details/93209437