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
What stored procedure can you use to display the current processes?
Suppose you want to implement the one-to-one relationships while designing tables. How would you do it?
Which tools are available to manage SQL Azure databases and servers?
What is difference between index seek vs. Index scan?
What are the commands used in DCL?
Tell me what are the advantages of using stored procedures?
How can we determine what objects a user-defined function depends upon?
Can we join two tables without primary key?
What is subquery? Explain the properties of a subquery?
Are null values the same as that of zero or a blank space?
You have developed an application which uses many stored procedures and triggers to update various tables users ocassionally get locking problems which tool is best suited to help you diagnose the problem?
What's the information that can be stored inside a bit column?
What the different types of Replication and why are they used?
Explain try...catch with sql server?
What is the use of custom fields in report?