select count(distinct left(name,35))/count(*) from b2b_goods;
Determine the appropriate index length through the above sql
b2b_goods is the name of the table;
name is the name of the field
to set the index ; 35 is the length of the set index;
For example, the length of the name field is 100.
When the '35' of the above SQL increases from 0 to 100, the result of the above query should be a curve starting from 0 and gradually approaching 1 until reaching 1, similar to the following figure:
When the field length is very long, when you set the length of the index at this time, the coverage rate of the index reaches more than 90%, that is, the initial query result is more than 0.9.
If you need higher requirements, you can continue to add the index length to make it 99% or 100%.