路灯十三的博客

路灯十三的博客,喜欢游戏的你就到我的游戏博客http://www.ucboke.com

导航

oleDbDataAdapter和oracleDataAdapter适配器的性能差异

数据库为9i,数据连接都采用Microsoft Ole DB Provider for Oracle方法,分别使用oleDbDataAdapter和oracleDataAdapter适配器,采用以下代码:
private void Button1_Click(object sender, System.EventArgs e)
  {
   Response.Write(DateTime.Now.Minute.ToString() + " "+  DateTime.Now.Second.ToString() + "</br>");
   DataSet dstMe = new DataSet();
   this.oleDbDataAdapter1.Fill(dstMe);
   Response.Write(dstMe.Tables[0].Rows.Count.ToString() + "<br>");
   Response.Write(DateTime.Now.Minute.ToString() + " "+  DateTime.Now.Second.ToString() + "<br><br>");
  }

  private void Button2_Click(object sender, System.EventArgs e)
  {
   Response.Write(DateTime.Now.Minute.ToString() + " "+  DateTime.Now.Second.ToString() + "</br>");
   DataSet dstMe = new DataSet();
   this.oracleDataAdapter1.Fill(dstMe);
   Response.Write(dstMe.Tables[0].Rows.Count.ToString() + "<br>");
   Response.Write(DateTime.Now.Minute.ToString() + " "+  DateTime.Now.Second.ToString() + "<br><br>");  
  }


性能差异如下:

数据适配器                       8000条数据量                150000条数据量
----------------------------------------------------------------------------------------
oleDbDataAdapter        2秒                                     38秒
oracleDataAdapter        2-3秒                                 31秒

结论如下:
当少量数据的时候(目前测试结果8000条以内),采用oleDbDataAdapter和oracleDataAdapter性能一样;
当大量数据的时候(目前测试结果150000条以外),采用oracleDataAdapter更适合;

posted on 2006-01-05 15:49  路灯十三  阅读(398)  评论(0编辑  收藏  举报