Express your experience in order to improve the efficiency of query
Express your experience in order to improve the efficiency of query
The post of the former blogger
Http://www.cnblogs.com/zhangyabin---acm/p/5955001.html
When super-large business data are in the same table, but there are no other business fields to distinguish
You can use the following methods:
The business scenario is as follows: in a massive database, query the data of a row, and there is no way to exclude it through the business. For example, the amount of data under a certain category is very large, but it needs to be entered.
Real-time precise search of rows
Use fixed columns (that is, columns that do not change due to business changes, usually sequences or irregular UID strings) to add individual strings or numbers
In this way, you can get a number or string. Using these numbers or strings, you can distinguish between the data. The reference ideas are as follows.
First, divide the table according to the last bit of the sequence value so that 10 sub-tables can be split, reducing the amount of data queried by 10 times.
Character ID can be added by each character of a string to get a sub-table or a distinguishing condition.