Category: Database, Data

A lot of stored procedures have multiple statements and determining the most costly statement in a given proc is a very common task. After all, you want to focus your time and efforts on fixing the things that cause you the most pain. You simply don't have the time to tune every single statement in every single procedure.

Once we've identified which procedure we care about, you can get that object_id for the procedure and filter sp_statement_completed by that value.

Related Articles