General index and unique index, how should choose

 

1 inquiry process
   Almost no effect
 
2 update process
   If the data page in memory, direct update, if not in the data page, put the updated record record in change buffer, so that you do not need to read the data page from disk. The next time the query reads the data page, and then modify it as change buffer
 
3 change buffer for Write Once Read Many small business
 
4 change buffer reduces the read disk IO, redo log reduction in the random write disk IO
 
 
 
Whether to use a unique index
 
First, the business correctness priority. The premise of this article is "business code has been written to ensure that no duplication of data" to discuss performance issues.
If the business does not guarantee or business is required to do database constraint, then did not have a choice, you must create a unique index
Then, some "archive library" scene, you can consider using a common index. For example, online data to keep only half a year, and historical data in the archive library. At this time, the data has been archived to ensure that there is no unique key conflict. To improve the efficiency of the archive, consider the table inside a unique index into the general index
 
 

Guess you like

Origin www.cnblogs.com/liang545621/p/12606873.html