伊谢尔伦2017-04-17 14:42:55
As long as the column is operated on, the index will work.
But actually we also need to look at explaining and profiling
大家讲道理2017-04-17 14:42:55
Look at the execution plan. You can see which step uses the index in the execution plan.
巴扎黑2017-04-17 14:42:55
1. Indexes are like the catalog of books or the alphabet and radical tables in a dictionary (this is also the original meaning of index). They are used when you need to search from a book or dictionary based on letters or radicals. It comes into play when the content is included;
2. The primary key, foreign key, unique key, and joint primary key of the table will automatically create an index. For example, if the id field of a single table is the primary key, then when making a query, where id = 'xxx' It may start to work. Pay attention to the circumstances under which the index is created, used, and index invalid.
3. Group by and having are used for grouping and filtering