sp_cmp_all_qplans

Compares all abstract plans in two abstract plan groups.

Syntax

sp_cmp_all_qplans group1, group2 [, mode]

Parameters

Examples

Usage

There are additional considerations when using sp_cmp_all_qplans:
  • Use sp_cmp_all_qplans to check for differences in abstract plans in two groups of plans.

  • sp_cmp_all_qplans matches pairs of plans where the plans in each group have the same user ID and query text. The plans are classified as follows:
    • Plans that are the same

    • Plans that have the same association key in both groups, but have different abstract plans. The association key is the group ID, user ID and query text.

    • Plans that exist in one group, but do not exist in the other group

  • To compare two individual abstract plans, use sp_cmp_qplans. To see the names of abstract plan groups, use sp_help_qpgroup.

  • When a system administrator or database owner runs sp_cmp_all_qplans, it reports on all plans in the two groups. When another user executes sp_cmp_all_qplans, it reports only on plans that have the user’s ID.

Permissions

The permission checks for sp_cmp_all_qplans differ based on your granular permissions settings.

SettingDescription
Enabled

With granular permissions enabled, you must be a user with manage abstract plans privilege or a user with 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.

Auditing

Values in event and extrainfo columns from the sysaudits table are:

InformationValues
Event

38

Audit option

exec_procedure

Command or access audited

Execution of a procedure

Information in extrainfo
  • Roles – Current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – All input parameters

  • Proxy information – Original login name, if set proxy in effect

Related reference
sp_cmp_qplans
sp_help_qpgroup