Barclays Interview Question: How to improve query performa... |

Interview Question

Configuration Manager Interview Pune

How to improve query performance in SQL?


Interview Answer

1 Answer


There are multiple ways to improve query performance .

1. Owner/Schema Name :
Always prefix object names (i.e. table name, stored procedure name, etc.) with its owner/schema name.

2. The * Operator :
Do not use the * operator in your SELECT statements. Instead, use column names.

3. Nullable Columns :
Do not use NOT IN when comparing with nullable columns. Use NOT EXISTS instead.

4. Table Variables and Joins :
Do not use table variables in joins. Use temporary tables, CTEs (Common Table Expressions), or derived tables in joins instead.

5. Stored Procedure Names :
Do not begin your stored procedure’s name with sp_.

Use SET NOCOUNT ON with DML operations.

7. Avoid Using GROUP BY, ORDER BY, and DISTINCT :
Avoid using GROUP BY, ORDER BY, and DISTINCT as much as possible

Anonymous on 20-Mar-2019

Add Answers or Comments

To comment on this, Sign In or Sign Up.