1.只是用字符串的最左边n个字符建立索引,推荐n<=10;比如index left(address,8),但是需要知道前缀索引不能在order by中使用,也不能用在索引覆盖上。
2.对字符串使用hash方法将字符串转化为整数,address_key=hashToInt(address),对address_key建立索引,查询时可以用如下查询where address_key = hashToInt(‘beijing,china’) and address = ‘beijing,china’;
3.关于like查询, "ide%"会使用索引, 如果%在最前则无法使用