How to speed up the paging?

H

hb

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
 
A

Alvin Bruney [MVP]

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.
 
J

Jeffrey Tan[MSFT]

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.
 
H

hb

Hi, Alvin,

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

hb
Alvin Bruney said:
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 said:
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
 
H

hb

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
 
J

Jeffrey Tan[MSFT]

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top