How many total select statements for a specific web page?

I was wondering what the easiest way is to see the total number of database requests from my ASP.Net (.NET 2.0) application.

My application makes heavy use of sql 2005 database because all data is dynamic and everything goes through one connection string in web.config. Connection pooling enabled.

So, I am wondering how many select statements are executed for a particular page that I load in my browser.

I don't care if I can see this information from the .net side or from the db side as long as I only see connections to the MY database. Not all connections to this db server because I am using a shared db server and there are many other databases.

+1


a source to share


6 answers


The best way to do this is to set up a profiler in your database and then make one request to your ASP.NET application.The profiler will collect any data you want and you can use that data to determine which queries were sent to SQL Server from your application.



+2


a source


The SQL Server Profiler will list all the actions performed on your database. If you are using a different db login for your project (it might be a really good idea if you haven't), you can filter to only display actions from your login (see Selecting Events, Column Filters. "Login name").



+1


a source


Use SQL Profiler. You can configure it to filter on the database you want and just display selection instructions.

0


a source


If you have a database tier in your code, you can change it to write a log message every time you run a select statement. Then just load the page once and count the number of log statements. This may or may not work depending on how your code is structured, but that's an option.

Edit: I misunderstood the question. I thought you had multiple clients connecting to the same database, not the same database server. In this case, a profiler is probably the best choice.

0


a source


Do you have access to SQL Server Profiler? You can set up traces to keep track of things like this by loading the page and looking at the effects in the profiler.

0


a source


JUst needs to be aware that Profiler can affect performance, so it's best to do this on dev.

0


a source







All Articles