Oracle tuning
- 使用绑定变量
- not in
使用 left join+is null 代替 - 清除表:truncate 优于 delete,但 truncate 属于dll故无法回滚
- 小心隐式数据类型转换导致无法使用索引
- 索引字段不应该是经常更新的字段,因为字段在更新后,该字段的索引旧值不会被删除,所以会造成索引膨胀
- 尽可能在内层循环中减少数据集
- 存在性的判断根本无需进行整体的count(*)判断:select count(*) from table1
where begintime >=trunc(sysdate-1) and rownum<2; - union all 优于 union:union 排序去重

(
(4.00 out of 5)