(1)
long time = System.currentTimeMillis();
ResultSet rs = stmt.executeQuery("select * from Tbl_Mms_User where MobilePhone='13956478952'");
System.out.println("xxxxxx:" + (System.currentTimeMillis() - time));
(2)
long time = System.currentTimeMillis();
List list = dao.find("select user from TblMmsUser user where user.MobilePhone=?", mobilePhone, Hibernate.STRING);
System.out.println("BaseReceiver.xxxxxx:" + (System.currentTimeMillis() - time));
这两段代码前一个直接用JDBC用时0,后一个Hibernate用时36
发问的原因中实际系统中用的是后一个,性能有很大问题,一个简单的查询尽用了0.5秒,表在MobilePhone有索引
数据库是SQLServer2000
long time = System.currentTimeMillis();
ResultSet rs = stmt.executeQuery("select * from Tbl_Mms_User where MobilePhone='13956478952'");
System.out.println("xxxxxx:" + (System.currentTimeMillis() - time));
(2)
long time = System.currentTimeMillis();
List list = dao.find("select user from TblMmsUser user where user.MobilePhone=?", mobilePhone, Hibernate.STRING);
System.out.println("BaseReceiver.xxxxxx:" + (System.currentTimeMillis() - time));
这两段代码前一个直接用JDBC用时0,后一个Hibernate用时36
发问的原因中实际系统中用的是后一个,性能有很大问题,一个简单的查询尽用了0.5秒,表在MobilePhone有索引
数据库是SQLServer2000