Indexing is simple, what is this index name CID used when I write a MySQL statement?
Or is this CID only used when working with the index inside MySQL, and I don't use it when I write a statement?
Is it generally done to index it, and MySQL internally handles everything about the index? What else do I have to write myself?
Reply content:
Indexing is simple, what is this index name CID used when I write a MySQL statement?
Or is this CID only used when working with the index inside MySQL, and I don't use it when I write a statement?
Is it generally done to index it, and MySQL internally handles everything about the index? What else do I have to write myself?
If you are concerned about whether an SQL query is indexed, you can EXPLAIN SELECT * FROM xxx WHERE yyy
look at the query plan and it will tell you what index you are using, and here you will see your index name.
There is also an occasion where you will use the index name, that is, if you want to force an index to query, you can use SELECT * FROM xxx FORCE INDEX yyy WHERE zzz
, on the contrary, if you want to force ignore an index, you can use theSELECT * FROM xxx IGNORE INDEX yyy WHERE zzz
The differentiating function plays a differentiating function from the differentiating effect
First you need to understand what the index is, why the index can speed up the query, the index is to tell the data according to a certain collation of the data according to the index given rules, such as a union A,b,c index, he will be the data according to a B C code, when a query quotations such as SELECT * From TB1 where a=1 and b=2 order by C so MySQL will first use the A field to quickly locate the data on the disk, when the B data is ordered in accordance with the rules of a, so you can quickly locate the data range, the last C field is also ordered, So it can play a very good role, if there is no straight bottom is such, MySQL will go to the data on the disk to take a row and then the condition does not conform to the discard, and finally in accordance with the collation of the file sort, simply of course not only these, but also MySQL clustered index, index coverage, MyISAM InnoDB index rules, MyISAM index leaves do not directly store data, but instead point to a reference to a physical row, and InnoDB data is a reference to the primary key primary key, if not explicitly indicated primary Key. The system automatically generates an implicit primary key so that it simply points to the primary key reference, suggesting that the system learns