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.
- 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.