zoukankan      html  css  js  c++  java
  • mysql存储过程对900w数据进行操作测试

    新增索引:
    LTER TABLE `tablename` ADD INDEX `sdhid` (`createTime`) USING BTREE ;
    [SQL]ALTER TABLE `tablename` ADD INDEX `sdhid` (`createTime`) USING BTREE ;
    受影响的行: 0
    时间: 737.600s

    [SQL]ALTER TABLE  tablename add INDEX jkjk(createTime) USING BTREE;
    受影响的行: 0
    时间: 1586.745s 26分钟

    [SQL]delete from tablename where createTime< 95 limit 1;
    受影响的行: 0
    时间: 109.540s

    createTime有索引时删除测试:
    [SQL]ALTER TABLE  tablename add INDEX jkjk(createTime) USING BTREE;
    受影响的行: 0
    时间: 1586.745s 26分钟

    [SQL]delete from tablename where createTime< 95 limit 1;
    受影响的行: 0
    时间: 109.540s

    [SQL] delete from tablename where createTime< 95 order by createTime,id limit 1;
    [Err] 1205 - Lock wait timeout exceeded; try restarting transaction

    [SQL] delete from tablename where createTime< 95 order by createTime,id limit 1;
    受影响的行: 0
    时间: 185.007s

    [SQL]delete from tablename where createTime< 95 order by createTime limit 1;
    受影响的行: 0
    时间: 169.260s

    [SQL]delete from tablename where createTime< 95 limit 1;
    受影响的行: 0
    时间: 153.959s

    createTime无索引时删除测试:
    [SQL]delete from tablename where createTime< 95 limit 1;
    [Err] 1205 - Lock wait timeout exceeded; try restarting transaction

    [SQL]delete from tablename where createTime< 95 limit 1;
    [Err] 1205 - Lock wait timeout exceeded; try restarting transaction

    [SQL] delete from tablename where createTime< 95 order by createTime,id limit 1;
    [Err] 1205 - Lock wait timeout exceeded; try restarting transaction

    [SQL]delete from tablename where createTime< 95 limit 1;
    [Err] 1205 - Lock wait timeout exceeded; try restarting transaction

    [SQL]delete from tablename where createTime< 95 limit 1;
    [Err] 1205 - Lock wait timeout exceeded; try restarting transaction

    [SQL]delete from tablename where createTime< 95 limit 1;
    [Err] 1205 - Lock wait timeout exceeded; try restarting transaction

    [SQL]delete from tl_accrued_bil_dtl where create_tm< NOW() limit 1;
    受影响的行: 1
    时间: 118.756s

    [SQL]delete from tl_accrued_bil_dtl where create_tm< NOW() and id=1;
    受影响的行: 1
    时间: 0.042s
    [SQL]delete from tl_accrued_bil_dtl where create_tm< NOW() limit 1;
    受影响的行: 1
    时间: 80.775s

    [SQL]delete from tl_accrued_bil_dtl where create_tm< NOW() and id=3;
    受影响的行: 1
    时间: 0.052s

    [SQL]SELECT * FROM tl_accrued_bil_dtl where create_tm< NOW() ORDER BY id limit 0,2
    受影响的行: 0
    时间: 0.011s

    [SQL]SELECT * FROM tl_accrued_bil_dtl where create_tm< NOW() ORDER BY create_tm limit 0,2
    受影响的行: 0
    时间: 0.011s

    [SQL]SELECT * FROM tl_accrued_bil_dtl where create_tm< NOW()  limit 0,2
    受影响的行: 0
    时间: 0.978s

    [SQL]SELECT * FROM tl_accrued_bil_dtl where create_tm< NOW()  limit 1000
    受影响的行: 0
    时间: 0.966s

    [SQL]SELECT * FROM tl_accrued_bil_dtl where create_tm< NOW()  limit 1000
    受影响的行: 0
    时间: 1.052s

    [SQL]SELECT * FROM tl_accrued_bil_dtl where create_tm< NOW()  limit 0,1000
    受影响的行: 0
    时间: 1.028s

    [SQL]delete from tl_accrued_bil_dtl where create_tm<  NOW() and id=6;
    受影响的行: 1
    时间: 0.066s

    [SQL]delete from tl_accrued_bil_dtl where create_tm<  NOW() limit 1;
    受影响的行: 1
    时间: 36.632s

    [SQL]delete from tl_accrued_bil_dtl where create_tm<  NOW() limit 1000;
    受影响的行: 1000
    时间: 113.335s

    [SQL]delete from tl_accrued_bil_dtl where create_tm<  NOW() limit 1000;
    受影响的行: 1000
    时间: 72.046s

    [SQL]delete from tl_accrued_bil_dtl where create_tm<  NOW() limit 1000;
    受影响的行: 1000
    时间: 100.126s
    [SQL]delete from tl_accrued_bil_dtl where create_tm<  NOW() limit 1000;
    受影响的行: 1000
    时间: 100.126s

    [SQL]SELECT * FROM tl_accrued_bil_dtl where create_tm< NOW()  limit 1000
    受影响的行: 0
    时间: 1.159s

    [SQL]DELETE FROM tl_accrued_bil_dtl where id > 446851336 and id < 446852336 ORDER BY id;
    受影响的行: 999
    时间: 96.731s

    [SQL]DELETE FROM tl_accrued_bil_dtl where id > 446852336 and id < 446853336 ORDER BY id;
    受影响的行: 1
    时间: 66.578s

    [SQL]DELETE FROM tl_accrued_bil_dtl where id > 446853336 and id < 446854336 ORDER BY id;
    受影响的行: 999
    时间: 73.514s

    [SQL]DELETE FROM tl_accrued_bil_dtl where id > 446854336 and id < 446855336 ORDER BY id;
    受影响的行: 999
    时间: 71.382s


    时间: 144.727s
    Procedure executed successfully
    受影响的行: 0

    [SQL]DELETE FROM tl_accrued_bil_dtl where create_tm<NOW() LIMIT 999;
    受影响的行: 999
    时间: 70.356s

    [SQL]DELETE FROM tl_accrued_bil_dtl where create_tm<NOW() LIMIT 999;
    受影响的行: 999
    时间: 65.939s













    相关:ORACLE中用rownum分页并排序的SQL语句

  • 相关阅读:
    Java8简明教程(转载)
    Android开源代码分享
    Android关联源码support-v4的问题解决
    自定义控件的自定义的属性attrs.xml下的declare-styleable中format详解
    获得 LayoutInflater 实例的三种方式
    退出telnet
    Relay log read failure
    MySQL --log-slave-updates
    MySQL --slave-skip-errors
    MySQL 5.1.63 单机配置多实例(简单配置)
  • 原文地址:https://www.cnblogs.com/langtianya/p/4801871.html
Copyright © 2011-2022 走看看