1,740   MySQL

1,优化SQL

比如少用count(distinct(col))
2,优化索引

使用索引查询,避免全表扫描
3,增加缓存

使用缓存加快访问速度,比如Redis缓存
4,读写分离

主从数据库配置读写分离,或者使用中间件,比如atlas
5,表格分区

MySQL自带分区表格的功能,但是SQL需带上分区的列,不然还是会全区扫描;
6,表格拆分

将表格按照一定规则拆分,比如id奇偶性,这个需要跟业务代码配置,比较复杂




Leave a Reply

Your email address will not be published. Required fields are marked *