Reports the number of pages used by a table, an index, or a specific partition. Unlike data_pages, used_pages does include pages used for internal structures. This function replaces the used_pgs function used in versions of Adaptive Server earlier than 15.0.
used_pages(dbid, object_id [, indid [, ptnid]])
the database id where target object resides.
is the object ID of the table for which you want to see the used pages. To see the pages used by an index, specify the object ID of the table to which the index belongs.
is the index id of interest.
is the partition id of interest.
Returns the number of pages used by the object with a object ID of 31000114 in the specified database (including any indexes):
select used_pages(5, 31000114)
Returns the number of pages used by the object in the data layer, regardless of whether or not a clustered index exists:
select used_pages(5, 31000114, 0)
Returns the number of pages used by the object in the index layer for a clustered index. This does not include the pages used by the data layer:
select used_pages(5, 31000114, 1)
Returns the number of pages used by the object in the data layer of the specific partition, which in this case is 2323242432:
select used_pages(5, 31000114, 0, 2323242432)
used_pages(dbid, objid, 0) is identical to used_pages(dbid, objid, 1) in the case of an all-page lock table with a clustered index. This is similar to the old used_pgs(objid, doampg, ioampg) function.
All erroneous conditions result in a return value of zero.
ANSI SQL – Compliance level: Transact-SQL extension.
Any user can execute used_pgs.
Functions data_pages, object_id
Copyright © 2005. Sybase Inc. All rights reserved. |