zoukankan      html  css  js  c++  java
  • mysql插入多条数据时间复杂度比较

    • SQL脚本

    select * from users;

    • 方式一:

    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");
    insert into users(name, age, course_id) VALUES("test",1, "0");

    • 方式二:

    insert into users(name, age, course_id) VALUES("test",1, "0"),("test",1, "0"),("test",1, "0"),("test",1, "0"),

    ("test",1, "0"),("test",1, "0"),("test",1, "0"),("test",1, "0"),
    ("test",1, "0"),("test",1, "0"),("test",1, "0"),("test",1, "0"),
    ("test",1, "0"),("test",1, "0"),("test",1, "0"),("test",1, "0"),
    ("test",1, "0"),("test",1, "0"),("test",1, "0"),("test",1, "0"),
    ("test",1, "0"),("test",1, "0"),("test",1, "0"),("test",1, "0")


    • 时间损耗

    在插入上面24条数据的时候发现两者的执行效率相差比较大(近10倍的)

      方式一:

      方式二:


    •  扩展:

    那么jdbc中的批处理的内部实现是不是采用方式二的形式来实现呢?感兴趣的朋友可以查看下该部分的源码...

      

  • 相关阅读:
    Greenplum使用简明手册
    VMware虚拟机下实现Linux与window文件夹共享
    SSH实现在WIN7系统下访问虚拟机中的Linux系统
    转_Greenplum 数据库安装部署(生产环境)
    政府大数据平台定位(转)
    国内外政府大数据六大典型应用
    从数据仓库到大数据,数据平台这25年是怎样进化的?
    转_【大话IT】你离大数据架构师有多远?
    js时间格式化和相互转换
    矢量图(字体图标)
  • 原文地址:https://www.cnblogs.com/imaikce/p/6141032.html
Copyright © 2011-2022 走看看