How to debug a slow running SQL stored procedure?
Anonymous
1) Check if necessary field are only included in select statement 2) Check types of join applied 3) Check indexes if applied to a field which is present in where clause so the data retrieval will be fast and which in turn increased the performance of query. If not create index 4) check if same table being used by any other process and it locks the table. release the lock and check the query performance 5) create CTE and avoid using many subqueries or co-related queries 6) Check query execution plan 7) if nothing works, add some memory to DB server.
Check out your Company Bowl for anonymous work chats.