A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: Functions: System Functions

data_pgs()

The function data_pgs() is a system function and, starting with ASE 15.0, is replaced by the function data_pages().

Syntax of the String Function data_pgs()

    data_pgs( [dbid], object_id, {data_oam_pg_id | index_oam_pg_id} )
    

The parameters of the String Function data_pgs()

"dbid"
The parameter "dbid" is the unique identifier of a database, containing the data pages, as listed in the system table sysdatabases.

"object_id"
The parameter "object_id" is the unique identifier of the object listed in the column "id" in the system table sysobjects in the corresponding database.

"data_oam_pg_id"
The parameter "data_oam_pg_id" is the unique identifier of the OAM page, listed in the column doampg of the system table sysindexes.

"index_oam_pg_id"
The parameter "index_oam_pg_id" is the unique identifier for the index OAM page, listed in the column ioampg of the system table sysindexes.

Using the System Function data_pgs()

The function data_pgs() can be executed by every user on objects in the current database. It returns the number of pages in a table (doampg = page number for the "object allocation map" in a table) or indexes (ioampg = page number for the "object allocation map" in a table or LOB (Large Object)) passed to the function as a parameter. Only pages not used for ASE internal structures are considered. The function must be executed as part of a query on the system table sysindexes.

The return value does not contain pages, used for the administration of ASE internal structures. Pages used by ASE internally can be listed using the function used_pgs().

Example for the String Function data_pgs()

    select o.name,
    Pages = data_pgs(i.id, doampg)
    from sysindexes as i, sysobjects as o
    where i.id = o.id
    and i.id > 100
    and (indid = 1 or indid = 0)
    go
     name                           Pages       
     ------------------------------ ----------- 
     spt_values                              33 
     spt_monitor                              1 
     spt_limit_types                          1 
     syblicenseslog                           1 
     spt_ijdbc_table_types                    1 
     spt_ijdbc_mda                            9 
     spt_ijdbc_conversion                     1 
     ijdbc_function_escapes                   2 
     monTables                                0 
     monTableParameters                       0 
     monTableColumns                          0 
     monState                                 0 
     monEngine                                0 
     monDataCache                             0 
     monProcedureCache                        0 
     monOpenDatabases                         0 
     monSysWorkerThread                       0 
     monNetworkIO                             0 
     monErrorLog                              0 
     monLocks                                 0 
     monDeadLock                              0 
     monWaitClassInfo                         0 
     monWaitEventInfo                         0 
     monCachedObject                          0 
     monCachePool                             0 
     monOpenObjectActivity                    0 
     monIOQueue                               0 
     monDeviceIO                              0 
     monSysWaits                              0 
     monProcess                               0 
     monProcessLookup                         0 
     monProcessActivity                       0 
     monProcessWorkerThread                   0 
     monProcessNetIO                          0 
     monProcessObject                         0 
     monProcessWaits                          0 
     monProcessStatement                      0 
     monSysStatement                          0 
     monProcessSQLText                        0 
     monSysSQLText                            0 
     monCachedProcedures                      0 
     monProcessProcedures                     0 
     monSysPlanText                           0 
     spt_jdbc_table_types                     1 
     spt_mda                                  5 
     spt_jtext                                1 
     spt_jdbc_conversion                      1 
     jdbc_function_escapes                    2 

    (48 rows affected)
    

Returns the number of used pages for the object with id 1856006612 in the database with id 6.

See also:
col_length(),
col_name(),
curunreservedpgs(),
data_pages(),
datalength,
db_id,
db_name(),
host_id(),
host_name(),
index_col(),
index_colorder(),
is_quiesced(),
isnull(),
lct_admin(),
license_enable(),
lockscheme(),
object_id(),
object_name(),
pagesize(),
pointer_size(),
pnt_data_pgs(),
reserved_pages(),
reserved_pgs(),
row_count(),
rowcnt(),
show_sec_services(),
syb_quit(),
syb_sendmsg(),
tempdb_id(),
tran_dumptable_status(),
tsequal(),
used_pages(),
used_pgs() and
Functions.

See also:

ASE T-SQL - Aggregate Functions,
audit_event_name(),
col_length(),
col_name(),
curunreservedpgs(),
datachange(),
datalength(),
data_pages(),
db_id(),
db_name(),
host_id(),
host_name(),
identity(),
index_col(),
index_colorder(),
isnull(),
lct_admin(),
license_enabled(),
lockscheme(),
next_identity(),
object_id(),
object_name(),
pagesize(),
pointer_size(),
ptn_data_pgs(),
reserved_pages(),
reserved_pgs(),
rowcnt(),
row_count(),
showplan_in_xml(),
syb_sendmsg(),
syb_sendmsg(),
System Functions,
tempdb_id(),
tran_dumpable_status(),
tsequal(),
used_pages(),
used_pgs().