大数据量模糊匹配有快速响应的优化方案吗?
背景
MySQL,单表数据量超过 2000 万,需求是要求快速模糊查询。
select * from xxx where aaa like ‘%yyyyy’ ;
有快速优化方案吗?
背景
MySQL,单表数据量超过 2000 万,需求是要求快速模糊查询。
select * from xxx where aaa like ‘%yyyyy’ ;
有快速优化方案吗?
我觉得 reverse 这种,新数据库已经自己优化掉了。要不然 2000 万条数据无索引暴力查询,不知道慢到什么程度了。
https://dev.mysql.com/doc/refman/8.0/en/create-index.html
A key_part specification can end with ASC or DESC to specify whether index values are stored in ascending or descending order. The default is ascending if no order specifier is given. ASC and DESC are not permitted for HASH indexes. ASC and DESC are also not supported for multi-valued indexes. As of MySQL 8.0.12, ASC and DESC are not permitted for SPATIAL indexes.
好像这个只是吧索引的顺序按从小到大或者从大到小排吧?而不是把某一列的字符 reverse 以后生成索引?
REVERSE 是对针对字符串处理的。
ALTER TABLE table1 ADD INDEX REVERSE(col);