项目中历史账户数据类目需要重新对应,只是规范下建表语句,更新效率提高了快10倍
说明:1. ncrm_customer 表数据量约60W; yt_temp_cat 表数据量约2W, 为更新新建的临时表
2.hotsell_catid 类目ID,正式库类型是 int(11)
运行:
第一次更新时,为了简单,创建yt_temp_cat字段类型都给的varchar,结果这个语句死活更新了快50分钟,加了各种索引优化都没得用。
第二次规范建表,cat_id int(11) ,更新只要5分钟
执行sql:
update ncrm_customer a set a.hotsell_catid =( select b.cat_id from yt_temp_cat b where a.hotsell_catid=b.cat_path_id and a.hotsell_catid > 0 ) where a.hotsell_catid > 0;