reserved_pages

Description

Reports the number of pages reserved for a database, object, or index. 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)

Example 5

Use one of the following three methods to calculate space in a database with reserved_pages:

Usage

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