what does means ref=const,const in mysql explain statment?
i add index for the table and the index contains tow columns where statment contains two index columns and some not in index columns
why does the explain statment extra column show 'Using index' rather than 'Using index condition'(ICP) and why ref column show 'const,const'?
i want to know what's the different between 'ref=const,const' and 'extra=Using index condition'? how does it work and how to verify it
ref=constmeans that the table has at most one matching row, which is read at the start of the query. Because there is only one row, values from the column in this row can be regarded as constants by the rest of the optimizer. const tables are very fast because they are read only once.extra=Using index conditionmeans If an index column appears in the query criteria, but some conditions cannot use the index, it will be searched first based on the index's conditions to match the conditions that cannot be used.You can refer to the official document, which describes how to scan the table when ICP occurs https://dev.mysql.com/doc/refman/5.7/en/index-condition-pushdown-optimization.html