Monday, March 26, 2012

Number of SQL Queries too large?

Hi All,

I'm currently in the middle of building quite a large CMS using ASP.NET and MSSQL2K and have began to question if the amount of queries I am using for one page to be built is too many?

For one page (View Forum) I am getting all of the templates and checking access then pulling a list of threads, getting the first and last posts, then user info for the first and last posts... anyway to view 10 threads on the page the number of queries comes to about 54 and the page takes 0.064 seconds to load.

My question is, Is this to many queries to be running for a single page load? All queries are using Stored Procedures.

Thanks Guys.Hi,

Since you are using StoredProcedures, performance shouldnt be bad. However 54 queries for a page is a bit high

Did you try mingling one of these procedures within the other?

Anyway, you can try creating views and writing procedures to retrive data from them incase your queries involve table joins.

indexing your tables might be another good option. These are at the SQL Level.

Hope it helps.|||thanks for your reply,

I actually did see what would happen by pulling all the data in one request using table joins and such and it actually effected performance for the worse =(

I'm not worried about performance as it is currently as fast as I could hope, was just getting concerned about the ammount of requests to the database.

Thanks for your help =)|||Hi,

Your Welcome! As long as the page is served fast, you don't have to worry :)

Because, there will be an automatic timeout, if the executing query takes too much time.

Hope it helps.

No comments:

Post a Comment