Compares two abstract plans.
sp_cmp_qplans id1, id2
sp_cmp_qplans 411252620, 1383780087
The queries are the same. The query plans are the same.
sp_cmp_qplans 2091258605, 647777465
The queries are the same. The query plans are different.
The queries are the same.
The queries are different.
The queries are different but have the same hash key.
The query plans are the same.
The query plans are different.
To find the ID of a plan, use sp_help_qpgroup or sp_find_qplan. Plan IDs are also returned by create plan and are included in showplan output.
The permission checks for sp_cmp_qplans differ based on your granular permissions settings.
Setting | Description |
---|---|
Enabled | With granular permissions enabled, you must be a user with manage abstract plans privilege or monitor qp performance privilege. Any user can compare plans that they own. |
Disabled | With granular permissions disabled, you must be the database owner or a user with sa_role. Any user can compare plans that they own. |
Values in event and extrainfo columns from the sysaudits table are:
Information | Values |
---|---|
Event | 38 |
Audit option | exec_procedure |
Command or access audited | Execution of a procedure |
Information in extrainfo |
|