Steps to improve performance of a poor performing query

What are the steps to take to improve performance of a poor performing query?

Steps to take to improve performance of queries:
- Use indexes efficiently
- Create all primary and foreign keys and relationships among tables.
- Avoid using cursors
- Avoid using Select*, rather mention the needed columns and narrow the resultset as needed.
- Denormalize
- Use partitioned views
- Use temporary tables and table variables
- Reduce joins and heavy clauses like GROUP BY if not needed
- Implement queries as stored procedures.
- Have a WHERE Clause in all SELECT queries.
- Use data types wisely
- Instead of NULLS use string values such as N/A

What are the steps to take to improve performance of a poor performing query?

- Maximum use of indexes, stored procures should be done.
- Avoid excessive use of complicated joins and cursors.
- Avoid using conditional operators using columns of different tables.
- Make use of computed columns and rewriting the query.
Deadlock and live lock. How will you go about resolving deadlocks?
Deadlock and live lock - A deadlock occurs when two or more processes waits for a resource that is acquired by or is under the control of another process.....
What is blocking and how would you troubleshoot it?
What is blocking and how would you troubleshoot it? - Blocking occurs when two or more rows are locked by one SQL connection and a second connection to the SQL server requires a conflicting on lock on those rows........
Different types of BACKUPs available in SQL Server
Different types of BACKUPs available in SQL Server - Complete database backup: This type of backup will backup all the information in the database. Used most commonly for disaster recovery and takes the longest time to backup........
Post your comment