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?

Answers were Sorted based on User's Feedback



What is one of the first things you would do to increase performance of a query? For example, a bos..

Answer / 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

What is one of the first things you would do to increase performance of a query? For example, a bos..

Answer / george

I think the first thing we need to check for the index
defragmentation, truncating transaction log and shrinking
the tempdb as well, this is because first time the query
get executed in the short time only 30 Sec, however second
day time execution increased

Is This Answer Correct ?    8 Yes 0 No

Post New Answer

More SQL Server Interview Questions

How to get a list of columns in a view using the "sp_help" stored procedure?

0 Answers  


Your table has a large character field there are queries that use this field in their search clause what should you do?

0 Answers  


Do you know what is xpath?

0 Answers  


How does normalization work?

0 Answers  


How many full-text indexes can a table have?

0 Answers  






How to stop a loop early with break statements in ms sql server?

0 Answers  


How do I create a trace in sql server?

0 Answers  


What is difference between aggregate and analytic function?

0 Answers  


What does ss stand for sexually?

0 Answers  


How to Improve the performencs of SQL Server 2005 exclude stored Procedure and Indexes?

0 Answers  


What is tempdb in sql server?

0 Answers  


What is the significance of master, tempdb and model databases?

0 Answers  


Categories