像这样的sql如何优化
update a set isLatest='N', isHis='Y' where isLatest='Y' and id in (1,2,3,4,5,6,7,8,.....)
明确的说 isLatest isHis都是char(2),
我现在的想法是
1建立 索引(isLatest , id)
2将 isLatest isHis改为int 质疑这个有必要吗 按道理整形要比char快很多。
由于整个java工程代码庞大,所以字段类型一改几乎所有的代码都要修改,现在质疑是否 isLatest isHis改为int ?
另外这个索引(isLatest , id)有时候觉得有问题?
update a set isLatest='N', isHis='Y' where isLatest='Y' and id in (1,2,3,4,5,6,7,8,.....)
明确的说 isLatest isHis都是char(2),
我现在的想法是
1建立 索引(isLatest , id)
2将 isLatest isHis改为int 质疑这个有必要吗 按道理整形要比char快很多。
由于整个java工程代码庞大,所以字段类型一改几乎所有的代码都要修改,现在质疑是否 isLatest isHis改为int ?
另外这个索引(isLatest , id)有时候觉得有问题?
explain SQL语句
跟踪分析吧