mysql中的索引,在什么时候开始起作用.on?where?group by? having?
怪我咯
怪我咯 2017-04-17 14:40:55
0
4
656

在select步骤运行前,在哪一步开始起作用?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(4)
伊谢尔伦

As long as the column is operated on, the index will work.
But actually we also need to look at explaining and profiling

大家讲道理

Look at the execution plan. You can see which step uses the index in the execution plan.

巴扎黑

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

阿神

Generally use index for the field after where

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template