Establish common principles of database indexes

1. over 300 records, it should be indexed

2. It should be indexed fields:

    1. There must be an index on the primary and foreign keys

    2. often joined with other tables connected field

 

    3. regular columns scope of the query

    4. Column sorting frequently queried

    5.where clause field

    6.group by, order by, distnict behind Field

3. It should not be indexed fields:

    1. Query few columns

    2. The discrimination is not high (a large number of duplicate values) column

    3.text, image data type and bit columns. The amount of data in those columns either a large or small value

    4. often modified column

Guess you like

Origin www.cnblogs.com/youayou/p/11443340.html