mysql插入1亿条数据要多长时间?
@Test public void insert1000Data(){ try { String sql = "insert into usersss(name,descn)values(' 很郁闷 ',' 嘻嘻哈哈好嘻嘻哈哈好 ')" ; conn .setAutoCommit( false ); long start = System.currentTimeMillis (); for ( int x=0;x<10000;x++){ Statement stmt = conn .createStatement(); for ( int i=0;i<10000;i++){ stmt.execute(sql); } conn .commit(); } System. out .println(System.currentTimeMillis ()-start); } catch (SQLException e) { e.printStackTrace(); } } ?
Create table usersss(id int primary key auto_increment,name varchar(20),descn varchar(20)) ?
很有趣的实验,没玩过。+---------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+-------------------------+| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |+---------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+-------------------------+| usersss | InnoDB | 10 | Compact | 0 | 0 | 16384 | 0 | 0 | 0 | 1 | 2009-06-27 12:47:24 | NULL | NULL | utf8_general_ci | NULL | | InnoDB free: 2784256 kB |+---------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+-------------------------+ 4 楼 xucz153 2009-07-01 楼主再帖帖linux下怎么测试呀?还是用java来测试吗?SHELL可不可以做到呀?或者PERL 5 楼 maomiandyou 2010-03-24 闲的...