Index queries are important record query methods in the database. Do you want to enter an index and establish an index on those fields to consider the inquiry requirements of the actual database system, the following is given below some of the general principles:
1. Establish an index on the fields that are often used as the filter;
2. Establish indexes on the field of Group by, Order By in the SQL statement;
3. Unnecessary indexes, such as gender fields;
4. For frequent columns to avoid establish indexing;
5. Establish an index on the column (maintenance / external health) for the coupling;
6. Establish a composite index on multiple columns that are regularly accessed, but pay attention to the establishment of composite indexes to determine according to the frequency used;
7. By default, non-clustering index is established, but in the following cases, it is best to consider clustering indexes, such as: containing a limited number (not very little) unique column; for a wide range of queries;
Full use of indexes can reduce the number of times of scanning I / 0, effectively avoid searching for the entire table. Of course, reasonable indexes are built in the analysis and prediction of various queries, depends on DBA design of database structure.