假如有两个sql直接执行查询都只要1秒:
sql1查出来1万多条数据,
sql2查出来10万多条数据。分别调用DataAdapter.Fill(DataSet)方法花的时间:
sql1是1分钟多点,sql2是10几秒。具体的测试方法是
oda.SelectCommand = new OracleCommand(sql1, cn);
Console.WriteLine(DateTime.Now);
oda.Fill(ds1, "test1");
Console.WriteLine(DateTime.Now);
Console.WriteLine(); oda.SelectCommand = new OracleCommand(sql2, cn);
Console.WriteLine(DateTime.Now);
oda.Fill(ds2, "test2");
Console.WriteLine(DateTime.Now);
Console.WriteLine();请教一下是什么原因?另外说一下,虽然两个语句直接执行都只要1秒,但是sql1的执行计划的cost很大,会不会是这个原因?
sql1查出来1万多条数据,
sql2查出来10万多条数据。分别调用DataAdapter.Fill(DataSet)方法花的时间:
sql1是1分钟多点,sql2是10几秒。具体的测试方法是
oda.SelectCommand = new OracleCommand(sql1, cn);
Console.WriteLine(DateTime.Now);
oda.Fill(ds1, "test1");
Console.WriteLine(DateTime.Now);
Console.WriteLine(); oda.SelectCommand = new OracleCommand(sql2, cn);
Console.WriteLine(DateTime.Now);
oda.Fill(ds2, "test2");
Console.WriteLine(DateTime.Now);
Console.WriteLine();请教一下是什么原因?另外说一下,虽然两个语句直接执行都只要1秒,但是sql1的执行计划的cost很大,会不会是这个原因?
不知道你说的直接执行,指的是全部结果都返回以后的总时间,还是说只是执行select完不等结果的时间。