When to create an index? 1. Frequently query a field as a where condition statement
SQL > select * from student; schoolID from classes; classid from student
3. Sort fields to create indexes
4. Grouping fields can be indexed, because the premise of grouping is sorting
5. Statistical fields can be indexed, such as count(), Max ()
1. Fields that are frequently updated are not suitable for indexing
2. The columns that are not used in the WHERE condition are not suitable for creating indexes
3. Table data can be determined as less need not build index
4. Fields with repeated data and uniform distribution are not suitable for indexing (fields with poor uniqueness are not suitable for indexing), such as gender and true and false values
5. Columns that participate in column calculation are not suitable for index construction