表结构:
ida int
idb int
name varchar(20)
info text
存在SQL:
select * from scott where ida=? and idb=?
select * from scott where ida=?
select * from scott where idb=?
存在索引:
ind_ida(ida)
ind_idb(idb)
数据分布:
表 1000000 rows
ida不同值个数1000
idb不同值个数900
sql执行计划:
select * from scott where ida=? and idb=? --使用索引:ind_ida
场景一:
当再次插入90000条记录,ida不同值个数未发生变化,idb不同值个数为90900,但统计信息未触发更新阈值autovacuum_analyze_scale_factor,SQL仍使用原执行计划,导致数据库出现性能瓶颈
提问:基于此类场景有何优化措施能避免或尽量降低对数据库的影响?
收起