,I#Berkeley DB: Db.stat[P

Db.stat





import com.sleepycat.db.*;

!public Object Db.stat(int flags);





Description



6The Db.stat method creates a statistical structure and*fills it with statistics for the database.

BThe Db.stat method cannot be transaction protected, and, should2be done outside of the scope of a transaction.

GIn the presence of multiple threads or processes accessing an active:database, the returned information may be out-of-date.

?This method may access all of the pages in the database, andAtherefore may incur a severe performance penalty and have obvious3negative effects on the underlying buffer pool.

CThe flags parameter must be set to 0 or the following value:

`

Db.DB_RECORDCOUNT
Fill in the bt_nrecs information of the statistics structure,Hbut do not collect any other information. This flag makes it reasonableBfor applications to request a record count from a database without@incurring a performance penalty. It is only available for RecnoGdatabases, or Btree databases where the underlying database was createdwith the DB_RECNUM flag.


The Db.statHmethod throws an exception that encapsulates an errno on failure.#

Btree and Recno Statistics



)In the case of a Btree or Recno database,Dthe statistics are returned in an instance of DbBtreeStat. The data&fields are available from DbBtreeStat:

U

public int bt_magic;
Magic number that identifies the file as a btree file.A
public int bt_version;
The version of the btree file type.?
public int bt_flags;
Permanent database flags, including/DB_DUP, DB_FIXEDLEN, DB_RECNUM and DB_RENUMBER.
public int bt_minkey;
The bt_minkey value specified to Db.open, if any.|
public int bt_re_len;
The re_len value specified to Db.open, if any.|
public int bt_re_pad;
The re_pad value specified to Db.open, if any.9
public int bt_pagesize;
Underlying tree page size.:
public int bt_levels;
Number of levels in the tree.d
public int bt_nrecs;
Number of data items in the tree (since there may be multiple data items@per key, this number may not be the same as the number of keys).;
public int bt_int_pg;
Number of tree internal pages.8
public int bt_leaf_pg;
Number of tree leaf pages.<
public int bt_dup_pg;
Number of tree duplicate pages.<
public int bt_over_pg;
Number of tree overflow pages.<
public int bt_free;
Number of pages on the free list.M
public int bt_int_pgfree;
Number of bytes free in tree internal pages.J
public int bt_leaf_pgfree;
Number of bytes free in tree leaf pages.N
public int bt_dup_pgfree;
Number of bytes free in tree duplicate pages.N
public int bt_over_pgfree;
Number of bytes free in tree overflow pages.


The Db.statHmethod throws an exception that encapsulates an errno on failure.



Errors

OIf a fatal error occurs in Berkeley DB, the Db.stat method may fail and throw a}DbRunRecoveryException, at which point all subsequent database%calls will also fail in the same way.

The Db.stat&method may fail and throw an exceptionKfor any of the errors specified for the following Berkeley DB and C library functions:6Db.cursor,DBcursor->c_close(3),dbenv->db_paniccall(3), fflush(3), fprintf(3),>DbLockTab.get,8DbLock.put,>DbLockTab.vec, malloc(3),BDbMpoolFile.get,BDbMpoolFile.put, memset(3), strerror(3), vfprintf(3),and vsnprintf(3).



Class

-Db



See Also

4Db.close,6Db.cursor,0Db.del,.Db.fd,0Db.get,HDb.get_byteswapped,:Db.get_type,2Db.join,2Db.open,0Db.put,Db.statand2Db.sync.
ÿÿ