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中的批处理的内部实现是不是采用方式二的形式来实现呢?感兴趣的朋友可以查看下该部分的源码...

      

  • 相关阅读:
    电子邮件的工作原理
    常用邮箱服务器地址端口
    wpf \silverlight 保存控件为图片
    GIS理论(墨卡托投影、地理坐标系、地面分辨率、地图比例尺、Bing Maps Tile System)【转载】
    Visifire图表控件官网地址
    Ado方式导入excel混用数据类型引起数据缺失问题解决方法
    c#日期时间的操作
    获得excel的sheet名字
    正则表达式验证可发短信的号码,如手机号和小灵通号码(106+区号+号码)
    验证多行文本框输入长度的正则表达式
  • 原文地址:https://www.cnblogs.com/imaikce/p/6141032.html
Copyright © 2011-2022 走看看