zoukankan      html  css  js  c++  java
  • Adapter.Fill分页不如存储过程分页效率高

    adapter在填充数据时是通过dataReader来进行的,其分页仍会对所有数据进行读取

    下面是对Aapter.Fill的测试

                DataTable dt1 = new DataTable();
                DataTable dt2 = new DataTable();
                DataTable dt3 = new DataTable();
                SqlDataAdapter adapterA   = DbHelperSQL.SmartAdapter("select * from VehicleInformation");
                SqlDataAdapter adapterB   = DbHelperSQL.SmartAdapter("select top 10000 * from VehicleInformation");
                Console.WriteLine("总共:" + DbHelperSQL.GetSingle("select count(*) from VehicleInformation ").ToString());
                System.Diagnostics.Stopwatch stw = new System.Diagnostics.Stopwatch();

                stw.Start();
                adapterA.Fill(dt1);
                stw.Stop();
                Console.WriteLine("A:18w\t" + stw.ElapsedTicks.ToString());

                stw.Reset();
                stw.Start();
                adapterA.Fill(0, 10000, dt2);
                stw.Stop();
                Console.WriteLine("A:1w\t"+stw.ElapsedTicks.ToString());

                stw.Reset();
                stw.Start();
                adapterB.Fill(0,10000,dt3);
                stw.Stop();
                Console.WriteLine("B:1w\t" + stw.ElapsedTicks.ToString());

    ---------------------------------

    总共:185661
    A:18w   10192189734
    A:1w     1972474092
    B:1w     522854748

  • 相关阅读:
    MapReduce原理
    用redis构建分布式锁
    Python中类的特殊变量
    Python之元类
    python之WSGI与Guincorn
    一种消息和任务队列——beanstalkd
    LRU 算法
    extern、static、restrict、volatile 关键字
    bigtable原理
    Go的微服务库kite
  • 原文地址:https://www.cnblogs.com/djian/p/1888868.html
Copyright © 2011-2022 走看看