replicate  reverse

Chapter 2: Transact-SQL Functions

reserved_pages

Description

Reports the number of pages reserved to a table, index or a specific partition. The result includes pages used for internal structures.

This function replaces the old reserved_pgs function used in Adaptive Server versions earlier than 15.0.

Syntax

reserved_pages(dbid, object_id [, indid [, ptnid]])

Parameters

dbid

is the database ID of the database where the target object resides.

object_id

is an object ID for a table.

indid

is the index ID of target index.

ptnid

is the partition ID of target partition.

Examples

Example 1

Returns the number of pages reserved by the object with a object ID of 31000114 in the specified database (including any indexes):

select reserved_pages(5, 31000114)

Example 2

Returns the number of pages reserved by the object in the data layer, regardless of whether or not a clustered index exists:

select reserved_pages(5, 31000114, 0)

Example 3

Returns the number of pages reserved by the object in the index layer for a clustered index. This does not include the pages used by the data layer:

select reserved_pages(5, 31000114, 1)

Example 4

Returns the number of pages reserved by the object in the data layer of the specific partition, which in this case is 2323242432:

select reserved_pages(5, 31000114, 0, 2323242432)

Usage

In the case of an apl table, if a clustered index exists on the table, then passing in an in did of 0 will report the reserved data pages, and passing an indid of 1 will report the reserved index pages. All erroneous conditions will result in a value of zero being returned.

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute reserved_pgs.

See also

Command update statistics

Function data_pages, reserved_pages, row_count, used_pages





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

View this book as PDF