开发者社区 问答 正文

更新语句更新很慢。一般这样的更新语句如何优化?

update inv_dap_detail set upload_type_id = '0',updatetype_id = '1',updatetype_remark = ''
from inv_dap_master as a
where a.gu_id = inv_dap_detail.m_gu_id
and a.season = 'HO19'
and a.version_code = '2'
and inv_dap_detail.updatetype_id <> '3';
inv_dap_detail 240W行数据
inv_dap_master 54W行数据

展开
收起
我叫石头 2019-03-28 14:58:04 1941 分享 版权
1 条回答
写回答
取消 提交回答
  • 3年淘宝运营支撑系统研发,6年云数据库平台架构,RDS,NoSQL业务

    如果不涉及乐观锁,那么可以先查出
    a.season = 'HO19'
    and a.version_code = '2'
    条件的a.gu_id 结果后,再到inv_dap_detail 中带入查询;

    2019-07-17 23:32:07
    赞同 展开评论
问答地址: