sp_familylock  sp_fixindex

Chapter 1: System Procedures

sp_find_qplan

Description

Finds an abstract plan, given a pattern from the query text or plan text.

Syntax

sp_find_qplan pattern [, group ]

Parameters

pattern

is a string to find in the text of the query or abstract plan.

group

is the name of the abstract plan group.

Examples

Example 1

Reports on all abstract plans that have the string “from titles” in the query:

sp_find_qplan "%from titles%"
gid id          text
--- ----------- --------------------------------------------------
2   921054317 select count(*) from titles
2   921054317
         ( plan
        ( i_scan t_pub_id_ix titles )
        ( )
)
( prop titles
        ( parallel 1 )
        ( prefetch 16 )
        ( lru )
)
5   937054374 select type, avg(price) from titles group by type
5   937054374
         ( plan
        ( store Worktab1
                ( i_scan type_price titles )
        )
        ( t_scan ( work_t Worktab1 ) )
)
( prop titles
        ( parallel 1 )
        ( prefetch 16 )
        ( lru )

Example 2

Finds all plans that include a table scan operator:

sp_find_qplan "%t_scan%"

Example 3

Uses the range pattern matching to look for strings such as “table1”, “table2”, and so forth, in plans in the dev_plans group:

sp_find_qplan "%table[0-9]%", dev_plans

Usage

Permissions

Any user can execute sp_find_qplan. It reports only on abstract plans owned by the user who executes it, except when executed by a System Administrator or the Database Owner.

Auditing

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

Event

Audit option

Command or access audited

Information in extrainfo

38

exec_procedure

Execution of a procedure

  • 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

See also

System procedures sp_help_qpgroup, sp_help_qplan





Copyright © 2005. Sybase Inc. All rights reserved. sp_fixindex

View this book as PDF