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

Exception deserializing the package "The process cannot access the file because it is being used by another process."

Temporary enable and disable SSRS subscriptions