How to speed up the paging?

Discussion in 'ASP .Net Datagrid Control' started by hb, Feb 2, 2004.

  1. hb

    hb Guest

    Hi,

    I use a DataGrid to display 5 text fields information from SQL 2000
    database.
    The total amount of records to be displayed is around 800. I have sort and
    paging
    function on the DataGrid. the pagesize is 20. The data retrieving process
    takes 2sec
    on database server, but more than 1 minute on web page.

    The application is written in C#. Would you please give me some tips to
    improve
    the loading and paging speed?

    Thank you

    hb
    hb, Feb 2, 2004
    #1
    1. Advertising

  2. No, that is not normal behavior. Something is terribly wrong. Start by
    adding tracing to your project so you can see exactly which routine is
    bottlenecking. Tracing can be enabled thru the webconfig file. If you can't
    figure this out, post a portion of the tracing results, we can take a look.

    --
    Regards,
    Alvin Bruney [ASP.NET MVP]
    Got tidbits? Get it here...
    http://tinyurl.com/3he3b
    "hb" <> wrote in message
    news:...
    > Hi,
    >
    > I use a DataGrid to display 5 text fields information from SQL 2000
    > database.
    > The total amount of records to be displayed is around 800. I have sort and
    > paging
    > function on the DataGrid. the pagesize is 20. The data retrieving process
    > takes 2sec
    > on database server, but more than 1 minute on web page.
    >
    > The application is written in C#. Would you please give me some tips to
    > improve
    > the loading and paging speed?
    >
    > Thank you
    >
    > hb
    >
    >
    Alvin Bruney [MVP], Feb 3, 2004
    #2
    1. Advertising

  3. Hi hb,

    Thank you for posting in the community!

    Based on my understanding, in your web form, you use datagrid to bind to
    Sql Server database. Your data table has almost 800 records, and your data
    retrieving time cost 2 seconds, on database server, but more than 1 minute
    on web page.

    =======================================================
    How do you calculate your "retrieving time on database server"? Do you use
    Sql Query Analyzer?
    What does your "more than 1 minute on web page." mean? It means data
    retrieving time or the whole web page render time?
    What Sql sentence do you use?

    Based on my experience, your data retrieving time is too long. You may
    first determine whether the problem is due to the code or your system.

    I use the code below to retrieve Sql Server's default table "orders" in
    "northwind" database(This table contains 830 records), it only costs 0.160
    seconds:

    private void Page_Load(object sender, System.EventArgs e)
    {
    DateTime dt=DateTime.Now;
    SqlDataAdapter adapter=new SqlDataAdapter("select * from
    orders","server=localhost;database=northwind;uid=sa;pwd=");
    DataSet ds=new DataSet();
    adapter.Fill(ds);
    TimeSpan ts=DateTime.Now.Subtract(dt);

    Response.Write(ts.Seconds.ToString()+ " "+ts.Milliseconds.ToString());

    DataGrid1.DataBind();
    }

    I think you may post in microsoft.public.sqlserver.programming group to
    determine the Sql server performance issue. My colleague will hellp you
    there.

    For asp.net performance, you may use Custom Paging for datagrid to improve
    performance, please refer to the article below:
    http://www.dotnetjohn.com/articles/articleid28.aspx

    Also, you need reduce the use of web controls in your web form to reduce
    the viewstate.(You can determine if the viewstate is the bottleneck through
    "view source" of your rendered page)

    ====================================================
    Please apply my suggestion above and let me know if it helps resolve your
    problem.

    Thank you for your patience and cooperation. If you have any questions or
    concerns, please feel free to post it in the group. I am standing by to be
    of assistance.

    Best regards,
    Jeffrey Tan
    Microsoft Online Partner Support
    Get Secure! - www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.
    Jeffrey Tan[MSFT], Feb 3, 2004
    #3
  4. hb

    hb Guest

    Hi, Alvin,

    Thank you for the help! I will spend time to look into it.

    hb
    "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
    news:Oy7E$...
    > No, that is not normal behavior. Something is terribly wrong. Start by
    > adding tracing to your project so you can see exactly which routine is
    > bottlenecking. Tracing can be enabled thru the webconfig file. If you

    can't
    > figure this out, post a portion of the tracing results, we can take a

    look.
    >
    > --
    > Regards,
    > Alvin Bruney [ASP.NET MVP]
    > Got tidbits? Get it here...
    > http://tinyurl.com/3he3b
    > "hb" <> wrote in message
    > news:...
    > > Hi,
    > >
    > > I use a DataGrid to display 5 text fields information from SQL 2000
    > > database.
    > > The total amount of records to be displayed is around 800. I have sort

    and
    > > paging
    > > function on the DataGrid. the pagesize is 20. The data retrieving

    process
    > > takes 2sec
    > > on database server, but more than 1 minute on web page.
    > >
    > > The application is written in C#. Would you please give me some tips to
    > > improve
    > > the loading and paging speed?
    > >
    > > Thank you
    > >
    > > hb
    > >
    > >

    >
    >
    hb, Feb 3, 2004
    #4
  5. hb

    hb Guest

    Hi, Jeff,

    Thank you very much for your help.

    With your Dataset approach, the page loads much fast now. I have been using
    XML
    to retrieve data and bind the data to DataGrid. It seems that I was wrong in
    terms of performance, at least in this case.

    Thank you again.
    hb
    ""Jeffrey Tan[MSFT]"" <> wrote in message
    news:...
    >
    > Hi hb,
    >
    > Thank you for posting in the community!
    >
    > Based on my understanding, in your web form, you use datagrid to bind to
    > Sql Server database. Your data table has almost 800 records, and your data
    > retrieving time cost 2 seconds, on database server, but more than 1 minute
    > on web page.
    >
    > =======================================================
    > How do you calculate your "retrieving time on database server"? Do you use
    > Sql Query Analyzer?
    > What does your "more than 1 minute on web page." mean? It means data
    > retrieving time or the whole web page render time?
    > What Sql sentence do you use?
    >
    > Based on my experience, your data retrieving time is too long. You may
    > first determine whether the problem is due to the code or your system.
    >
    > I use the code below to retrieve Sql Server's default table "orders" in
    > "northwind" database(This table contains 830 records), it only costs 0.160
    > seconds:
    >
    > private void Page_Load(object sender, System.EventArgs e)
    > {
    > DateTime dt=DateTime.Now;
    > SqlDataAdapter adapter=new SqlDataAdapter("select * from
    > orders","server=localhost;database=northwind;uid=sa;pwd=");
    > DataSet ds=new DataSet();
    > adapter.Fill(ds);
    > TimeSpan ts=DateTime.Now.Subtract(dt);
    >
    > Response.Write(ts.Seconds.ToString()+ " "+ts.Milliseconds.ToString());
    >
    > DataGrid1.DataBind();
    > }
    >
    > I think you may post in microsoft.public.sqlserver.programming group to
    > determine the Sql server performance issue. My colleague will hellp you
    > there.
    >
    > For asp.net performance, you may use Custom Paging for datagrid to improve
    > performance, please refer to the article below:
    > http://www.dotnetjohn.com/articles/articleid28.aspx
    >
    > Also, you need reduce the use of web controls in your web form to reduce
    > the viewstate.(You can determine if the viewstate is the bottleneck

    through
    > "view source" of your rendered page)
    >
    > ====================================================
    > Please apply my suggestion above and let me know if it helps resolve your
    > problem.
    >
    > Thank you for your patience and cooperation. If you have any questions or
    > concerns, please feel free to post it in the group. I am standing by to be
    > of assistance.
    >
    > Best regards,
    > Jeffrey Tan
    > Microsoft Online Partner Support
    > Get Secure! - www.microsoft.com/security
    > This posting is provided "as is" with no warranties and confers no rights.
    >
    hb, Feb 3, 2004
    #5
  6. Hi hb,

    I am glad my reply makes sense to you.

    If you have any further concern, please feel free to post, we will help
    you. :)

    Best regards,
    Jeffrey Tan
    Microsoft Online Partner Support
    Get Secure! - www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.
    Jeffrey Tan[MSFT], Feb 4, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ham

    I need speed Mr .Net....speed

    Ham, Oct 28, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    2,316
    Antony Baula
    Oct 29, 2004
  2. efiedler
    Replies:
    1
    Views:
    2,015
    Tim Ward
    Oct 9, 2003
  3. Replies:
    2
    Views:
    2,268
    Howard
    Apr 28, 2004
  4. Replies:
    2
    Views:
    330
    Christopher Benson-Manica
    Apr 28, 2004
  5. Weng Lei-QCH1840
    Replies:
    1
    Views:
    174
    Thomas
    Aug 15, 2003
Loading...

Share This Page