sp_help_qplan  sp_helpcache

Chapter 1: System Procedures

sp_helpartition

Description

Lists partition-related information of a table or index.

Syntax

sp_helpartition [ tabname [, { null | indexname | ‘all’ }[, partitionname ] ] ]

Parameters

tabname

is the name of a table in the current database.

null

specifies that information about base table partitions is to be listed.

indexname

is the name of an index in the current table. Information about this index displays.

‘all’

specifies that all index partition information is to be listed.

partitionname

is the name of the partition in the base table or index.

Examples

Example 1

Returns summary and detailed information about the data partitions in the titles table.

sp_helpartition titles
name    type        partition_type   partitions    partition_keys
------    -------     --------------   -----------   --------------
titles    base table  range                      4      pubdate

partition_name  partition_id   pages     segment    create_date
--------------  ------------   --------  --------   ----------------
q1              1136004047          1    default   Oct 13 2005 10:33AM
q2              1152004104          1    default   Oct 13 2005 10:33AM
q3              1168004161          1    default   Oct 13 2005 10:33AM
q4              1184004218          1    default   Oct 13 2005 10:33AM

Partition_Conditions
--------------------
VALUES  <= (“3/31/2006”)
VALUES  <= (“6/30/2006”)
VALUES  <= (“9/30/2006”)
VALUES  <= (“12/31/2006”)

Avg_pages  Max_pages  Min_pages   Ratio(Max/Avg)   Ratio(Min/Avg)
---------  ---------  ---------   ---------------  ------------
1                  1          1          1.000000      1.000000

Example 2

Displays summary partition information about titles table and detailed information about the q1 data partition.

sp_helpartition titles, null, q1

name    type        partition_type   partitions    partition_keys
------    -------     --------------   -----------   --------------
titles    base table  range                      4         pubdate

partition_name  partition_id   pages     segment    create_date
--------------  ------------   --------  --------   ----------------
q1              1136004047          1    default   Oct 13 2005 10:33AM

Partition_Conditions
--------------------
VALUES  <= (“3/31/2006”)

Example 3

Displays summary and detailed information about the index title_idx on the titles table.

sp_helpartition titles, title_idx

name       type          partition_type   partitions    partition_keys
------     -------       --------------   ----------    --------------
title_idx  local index  range                      4    pubdate

partition_name       partition_id  pages   segment    create_date
--------------       ------------  ------  --------   ----------------
title_idx_1029575675 1029575675        1   default    Oct 13 2005 10:33AM
title_idx_1045575732 1045575732        1   default    Oct 13 2005 10:33AM
title_idx_1061575789 1061575789        1   default    Oct 13 2005 10:33AM
title_idx_1077575846 1077575846        1   default    Oct 13 2005 10:33AM

Partition_Conditions
--------------------
VALUES  <= (“3/31/2006”)
VALUES  <= (“6/30/2006”)
VALUES  <= (“9/30/2006”)
VALUES  <= (“12/31/2006”)

Avg_pages  Max_pages  Min_pages   Ratio(Max/Avg)   Ratio(Min/Avg)
---------  ---------  ---------   ---------------  ------------
1                  1          1          1.000000      1.000000

Usage


Accuracy of results

Permissions

Any user can execute sp_helpartition.

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

Catalog system procedures sp_statistics

Commands alter table, create table, select into

System procedures sp_helpsegment





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

View this book as PDF