- Always try to use views and stored procedures instead of doing work with heavy queries.
- Make a habit to use constraints instead of triggers whenever it is possible.
- When you need n number of row from database try to use top keyword or SET ROWCOUNT statement.
- Always use table variables in place of temporary tables.
- Avoid Union and try to use UNION ALL statement.
- Always avoid using the DISTINCT clause, whenever possible.
- Always try to avoid using SQL Server cursors.
- Always try to avoid the HAVING clause.
- Donot use select count(*) to get number of rows
- Try to include SET NOCOUNT ON statement into your stored procedures to stop the message indicating the number of rows affected by a T-SQL statement.
- Always use file system to store large binary objects and use the file path in database.
- Sometimes we may have to apply more than one subqueries in our main query. Try to minimize the number of subquery block in your query.
- Try to use column name insted of *