1 class TopList extends DataBaseModel implements Serializable, Cloneable { @AttColumn(index = true) pid; @AttColumn(index = true) point; @AttColumn(index = true) integral; star; time; getPid() { 18 return pid; 19 } setPid(long pid) { 22 this.pid = pid; 23 } getPoint() { 26 return point; 27 } setPoint(int point) { 30 this.point = point; 31 } getStar() { 34 return star; 35 } setStar(int star) { 38 this.star = star; 39 } getTime() { 42 return time; 43 } setTime(long time) { 46 this.time = time; 47 } getIntegral() { 50 return integral; 51 } setIntegral(int integral) { 54 this.integral = integral; 55 } 56 57 @Override 58 public Object clone() { 59 try { .clone(); } catch (CloneNotSupportedException ex) { 62 } ; 64 } 65 66 }
View Code
修改模型,在玩家id,分数,关卡,这三个地方加入索引;
1 [07-25 13:11:04:759:DEBUG:CUDThread.run():219] 新增数据插入影响行数:5000 耗时:662 2 [07-25 13:11:04:760:DEBUG:CUDThread.run():246] 当前待处理剩余数量:22525 3 [07-25 13:11:05:549:DEBUG:CUDThread.run():219] 新增数据插入影响行数:5000 耗时:787 4 [07-25 13:11:05:550:DEBUG:CUDThread.run():246] 当前待处理剩余数量:24975 5 [07-25 13:11:06:437:DEBUG:CUDThread.run():219] 新增数据插入影响行数:5000 耗时:885 6 [07-25 13:11:06:438:DEBUG:CUDThread.run():246] 当前待处理剩余数量:27030 7 [07-25 13:11:07:198:DEBUG:CUDThread.run():219] 新增数据插入影响行数:5000 耗时:759 8 [07-25 13:11:07:199:DEBUG:CUDThread.run():246] 当前待处理剩余数量:27454 9 [07-25 13:11:08:023:DEBUG:CUDThread.run():219] 新增数据插入影响行数:5000 耗时:823 10 [07-25 13:11:08:027:DEBUG:CUDThread.run():246] 当前待处理剩余数量:27449 11 [07-25 13:11:08:966:DEBUG:CUDThread.run():219] 新增数据插入影响行数:5000 耗时:936 12 [07-25 13:11:08:967:DEBUG:CUDThread.run():246] 当前待处理剩余数量:27900 13 [07-25 13:11:09:945:DEBUG:CUDThread.run():219] 新增数据插入影响行数:5000 耗时:977
数据库数据越来越多的时候,插入速度就会越来越慢;看下图,是不是很吓人?