V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
MySQL 5.5 Community Server
MySQL 5.6 Community Server
Percona Configuration Wizard
XtraBackup 搭建主从复制
Great Sites on MySQL
Percona
MySQL Performance Blog
Severalnines
推荐管理工具
Sequel Pro
phpMyAdmin
推荐书目
MySQL Cookbook
MySQL 相关项目
MariaDB
Drizzle
参考文档
http://mysql-python.sourceforge.net/MySQLdb.html
chaodada
V2EX  ›  MySQL

求助大佬帮忙看看 sql 大约有两百万数据执行批量修改太慢了 有啥优化的好办法码

  •  
  •   chaodada · 2020-01-03 18:24:10 +08:00 · 3843 次点击
    这是一个创建于 1786 天前的主题,其中的信息可能已经有所发展或是发生改变。
    
    0
    UPDATE `wx_user` SET `member_id` = '378281'  WHERE  login_id='1362' and   vip ='1' and shangji_id='378281'
    0
    UPDATE `wx_user` SET `member_upgrade_time` = '1578046841'  WHERE login_id='1362' and  `id` = '378284'
    1
    UPDATE `wx_user` SET `member_id` = '378284' WHERE  login_id='1362' and   id > '378284'  and  `member_id` ='343296' and  `path` LIKE '/0/343264/343296/378284/%'
    0
    UPDATE `wx_user` SET `member_id` = '378284'  WHERE  login_id='1362' and   vip ='1' and shangji_id='378284'
    0
    UPDATE `wx_user` SET `member_upgrade_time` = '1578046842'  WHERE login_id='739' and  `id` = '378290'
    1
    UPDATE `wx_user` SET `member_id` = '378290' WHERE  login_id='739' and   id > '378290'  and  `member_id` ='377382' and  `path` LIKE '/0/314155/374804/377382/378290/%'
    0
    UPDATE `wx_user` SET `member_id` = '378290'  WHERE  login_id='739' and   vip ='1' and shangji_id='378290'
    0
    UPDATE `wx_user` SET `member_upgrade_time` = '1578046842'  WHERE login_id='739' and  `id` = '378300'
    1
    UPDATE `wx_user` SET `member_id` = '378300' WHERE  login_id='739' and   id > '378300'  and  `member_id` ='0' and  `path` LIKE '/0/378300/%'
    0
    UPDATE `wx_user` SET `member_id` = '378300'  WHERE  login_id='739' and   vip ='1' and shangji_id='378300'
    0
    UPDATE `wx_user` SET `member_upgrade_time` = '1578046842'  WHERE login_id='739' and  `id` = '378309'
    1
    UPDATE `wx_user` SET `member_id` = '378309' WHERE  login_id='739' and   id > '378309'  and  `member_id` ='377329' and  `path` LIKE '/0/314155/377329/378309/%'
    0
    UPDATE `wx_user` SET `member_id` = '378309'  WHERE  login_id='739' and   vip ='1' and shangji_id='378309'
    0
    UPDATE `wx_user` SET `member_upgrade_time` = '1578046842'  WHERE login_id='1362' and  `id` = '378313'
    1
    UPDATE `wx_user` SET `member_id` = '378313' WHERE  login_id='1362' and   id > '378313'  and  `member_id` ='343296' and  `path` LIKE '/0/343264/343296/378313/%'
    0
    UPDATE `wx_user` SET `member_id` = '378313'  WHERE  login_id='1362' and   vip ='1' and shangji_id='378313'
    0
    UPDATE `wx_user` SET `member_upgrade_time` = '1578046843'  WHERE login_id='739' and  `id` = '378316'
    1
    UPDATE `wx_user` SET `member_id` = '378316' WHERE  login_id='739' and   id > '378316'  and  `member_id` ='377335' and  `path` LIKE '/0/314155/377335/378316/%'
    
    

    目前 login_id 加了 index 索引 path 加了一个 fulltext 索引 求大佬帮忙看一下

    1 条回复    2020-01-04 11:22:52 +08:00
    surfire91
        1
    surfire91  
       2020-01-04 11:22:52 +08:00   ❤️ 1
    login_id 我看都是 739, 筛选性很小?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2664 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 05:39 · PVG 13:39 · LAX 21:39 · JFK 00:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.