If a query is performing slow , you need to check the following things


1. Indexes
Check if useful indexes are present . Take the help of Database Tuning Advisor in SQL  to get index suggestions.

2. Statistics
Index and column statistics are up to date or not . If they are not , then probably , query might not perform as required . In a frequently changing database , it may happen that statistics are out of date

3. Run the query in between
     SET STATISTICS PROFILE ON
            SET STATISTICS IO ON
            SET STATISTICS TIME ON
       [ Query ]
            SET STATISTICS TIME OFF
            SET STATISTICS IO OFF
            SET STATISTICS PROFILE OFF

Comments

Popular Posts

Failed to execute the package or element. Build errors were encountered

Restore of database 'DataBase_Name' failed. (Microsoft.SqlServer.Management.RelationalEngineTasks)

Get List of logins on SQL Server instance