any reason for mutliple rows for same object_id in sys.dm_exec_procedure_stats?

  • I ran a query to get last_elapsed_time from sys.dm_exec_procedure_stats, given the object_id of a particular sproc.

    The table had 2 rows with the same object_id for the sproc. I ran the sproc again and the row for the last sproc run was replaced with a row representing the latest sproc run. However, the row representing the run from earlier this morning still exists as a second row in this table.

    Do you expect that this table should have only 1 row per object_id? Is there a known quirk where sometimes additional rows exist in this table,

    and the dev just needs to remember to take the one with the latest datetimestamp? Or is there some reason that by design SS maintains more than a single row for an object_id in this table?

  • There are a number of reasons that there could be multiple execution plans for the same stored procedure. One common case is the connection settings of the sessions that call it are different, such as SET ARITHABORT ON which is by default different in Management Studio vs SQLCMD or .Net.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply