Index performance:
1. Do not design fields such as char (100) as indexes.
2. The number of index fields cannot exceed 3
3. The index will also be locked, which may cause performance problems of new locks.
4. Try to avoid using indexes. index is a performance method in exchange for space. Even if the query speed is increased, DML operations such as insert will become slower.
5. The order of fields used in the index is exquisite.
6. the maximum number of indexes for tables whose static table data does not change cannot exceed 5-8.
7. Create 2-5 indexes for the OLTP system business operation table
8. the OLAP system can create 5-8 indexes.
9. Which fields are indexed? indexes can be created only in the where condition. The groupby and orderby associated tables can be indexed. However, orderby in transactional systems should not be indexed, depending on the actual situation, it depends on the number of results records. If the number is small, for example, do not create an index within thousands of records.
10. For example, if C1 has 103 fields, C2 has 2 different values, and C3 has 100 fields, then C2 should not be used as a field.
11. Avoid building a composite index with a large field. If the number of records created by C2 differs little from the number of records before C2, you do not need to create an index.
12. Avoid using like, avoid using functions on index columns, and avoid using is null or is not null on indexes! =
13. Avoid changing the index column type and avoid having clauses.