What is one of the first things you would do to increase
performance of a query? For example, a boss tells you that
?a query that ran yesterday took 30 seconds, but today it
takes 6 minutes?

Answer Posted / bhaskar

Can u check the folliwing points are used in the procedure
or a Query.

Table should have primary key
Table should have minimum of one clustered index
Table should have appropriate amount of non-clustered index
Non-clustered index should be created on columns of table
based on query which is running
Following priority order should be followed when any index
is created a) WHERE clause, b) JOIN clause, c) ORDER BY
clause, d) SELECT clause
Do not to use Views or replace views with original source
table
Triggers should not be used if possible, incorporate the
logic of trigger in stored procedure
Remove any adhoc queries and use Stored Procedure instead
Check if there is atleast 30% HHD is empty - it improves
the performance a bit
If possible move the logic of UDF to SP as well
Remove * from SELECT and use columns which are only
necessary in code
Remove any unnecessary joins from table
If there is cursor used in query, see if there is any other
way to avoid the usage of this (either by SELECT … INTO or
INSERT … INTO, etc)
There are few hardware upgrades can be considered as well
like separating index on different disk drive or moving
tempdb to another drive. However, I am not suggesting them
here as they are not quick way to improve the performance
of query.

Is This Answer Correct ?    16 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to create new tables with "create table" statements in ms sql server?

565


Which are the new data types introduced in sql server 2008?

512


What is the use of toad or sqldbx.?

720


How to loop through result set objects using mssql_fetch_array()?

542


What guidelines should be followed to help minimize deadlocks?

502






Explain the relational database management system (rdbms)?

524


What is the latest version of microsoft sql server?

485


How many tables can be joined in SQL Server?

592


What are the properties of the transactions?

614


difference between Clustered index and non clustered index ?

574


Can I work with several databases simultaneously? : sql server management studio

562


Define a cross join?

594


What are difference between Cluster index and Non-Cluster index?

610


What is the difference between count and distinct count?

464


Why we use functions in sql server?

516