I have some SQL thats getting run and it is taking to long to return the results / parse / display, etc. in a asp.net c# application.
I have SQL Server Management Studio 2008 R2 installed to connect to a remote SQL Server 2000 machine. Is there a Query Analyzer or profiler I can use to see whats going on? I'm not sure if I'm sending too many requests, if the requests are taking too long, if there are additional indexes I can add to speed things up etc.
EDIT:
Any free tools out there that are replacements for the Microsoft tools开发者_开发技巧?
To analyze a query you already have entered into the Query editor, you need to choose "Include Actual Execution Plan" (7th toggle button to the right of the "! Execute" button). After executing the query, you need to click on the "Execution Plan" tab in the results pane at the bottom (above the results of the query).
Default locations:
Programs > Microsoft SQL Server 2008 R2 > SQL Server Management Studio for Query Analyzer. Programs > Microsoft SQL Server 2008 R2 > Performance Tools > SQL Server Profiler for profiler.
I know the question doesn't state SQL Server express, but its worth pointing out that the SQL Server Express editions don't come with the profiler (very annoying), and I suspect that they also don't come with the query analyzer.
From in Sql Server Management Studio: Tools -> Sql Server profiler. Although as @bobs said, you may need to install additional components first.
I don't know if this helps but I just installed Server 2008 Express and was disappointed when I couldn't find the query analyzer but I was able to use the command line 'sqlcmd' to access my server. It is a pain to use but it works. You can write your code in a text file then import it using the sqlcmd command. You also have to end your query with a new line and type the word 'go'.
Example of query file named test.sql:
use master;
select name, crdate from sysdatabases where xtype='u' order by crdate desc;
go
Example of sqlcmd:
sqlcmd -S %computername%\RLH -d play -i "test.sql" -o outfile.sql & notepad outfile.sql
You can use Database Engine Tuning Advisor.
This tool is for improving the query performances by examining the way queries are processed and recommended enhancements by specific indexes.
How to use the Database Engine Tuning Advisor?
1- Copy the select statement that you need to speed up into the new query.
2- Parse (Ctrl+F5).
3- Press The Icon of the (Database Engine Tuning Advisor).
Yes there is one and it is inside the SQLServer management studio. Unlike the previous versions I think. Follow these simple steps.
1)Right click on a database in the Object explorer 2)Selected New Query from the popup menu 3)Query Analyzer will be opened.
Enjoy work.
精彩评论