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

When to use Inner join & when to use subquery?

648


Explain about protocol layer present in SQL server?

690


What are the difficulties faced in cube development? : sql server analysis services, ssas

696


Tell me what are the advantages of using stored procedures?

648


What are the dis_advantages of stored procedures, triggers, indexes?

1787






1)what is the difference between Reinitializing a Subscription and synchronization the subscription? 2)when to use reinitializing ? 3)when to use synchronization? 4)when adding table or deleting a table what to do?(reinz.. or syn) 5)when adding a column what to do?

1635


What do you mean by sql server agent?

631


Why use “pivot” in sql server?

700


What is acid db?

593


How to modify an existing user defined function?

685


Explain triggers in sql?

625


What is the purpose of data source?

605


Can two tables have the same primary key?

693


What is use of dbcc commands?

703


Call by value and call by reference in procedure and function, with NOCOPY.

954