sql性能

1    hql更新,oracle库(dbcp)

 

 /**
   * @author zw
   * @date 2013-4-17
   */
  long beginTime = System.currentTimeMillis();
  // 注意条件:t.searchstate!='0'
  String sql = "update PortalKeyword t set t.searchstate='0' where t.providerid=:providerid and t.searchstate!='0'";
  Map<String, Object> params = new HashMap<String, Object>();
  params.put("providerid", providerId);
  int result = super.update(sql, params);
  long endTime = System.currentTimeMillis();
  System.out.println("秒:" + (endTime - beginTime) / 1000);
  System.out.println("毫秒:" + (endTime - beginTime));
  System.out.println("更新记录数:" + result);

  输出:

   Hibernate: update PORTAL_KEYWORD set SEARCHSTATE='0' where PROVIDERID=?

   and SEARCHSTATE<>'0'
  秒:0
  毫秒:40

  更新记录数:7

你可能感兴趣的:(sql)