Summarize some sql tuning

A, sql optimization

   1) column type defined value types as possible and as short as possible, such as primary keys and foreign keys, etc. type field
   2) to establish a separate index
   3) to establish a joint multi-column index as needed. After filtration, there are many single column of data, then the index will be relatively low efficiency, low discrimination that is listed, then the index if on multiple columns, multiple columns discrimination on most of will a significant increase in efficiency.
   4) establishment of a covering index based on business scenarios. Only query field business needs, if these fields are covered by the index, will greatly improve query efficiency
   5) needs to be indexed on the field multi-table joins, which can greatly improve the efficiency of the connection table
   6) needs where field conditions indexing
   7) needs to be indexed on the sort field
   8) the need for indexing the packet field
   9) not to use the function where the operational conditions, in order to avoid failure index

Guess you like

Origin www.cnblogs.com/Small-sunshine/p/10932536.html