Logo Search packages:      
Sourcecode: db4.2 version File versions  Download package

Object com::sleepycat::db::Db::stat ( int  flags  )  throws DbException [inline]

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

If the Db.DB_FAST_STAT flag has not been specified, the Db.stat method will access some of or all the pages in the database, incurring a severe performance penalty as well as possibly flushing the underlying buffer pool.

In the presence of multiple threads or processes accessing an active database, the information returned by Db.stat may be out-of-date.

If the database was not opened read-only and the Db.DB_FAST_STAT flag was not specified, the cached key and record numbers will be updated after the statistical information has been gathered.

The Db.stat method cannot be transaction-protected. For this reason, it should be called in a thread of control that has no open cursors or active transactions.

Hash Statistics

In the case of a Hash database, the statistics are returned in an instance of DbHashStat. The data fields are available from DbHashStat:

Btree and Recno Statistics

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

Queue Statistics

In the case of a Queue database, the statistics are returned in an instance of DbQueueStat. The data fields are available from DbQueueStat: For convenience, the DbBtreeStat, DbHashStat and DbQueueStat classes have a toString method that lists all their data fields.

Parameters:
flags must be set to 0 or one of the following values:
  • Db.DB_FAST_STAT

    Return only the values which do not require traversal of the database.

    Among other things, this flag makes it possible for applications to request key and record counts without incurring the performance penalty of traversing the entire database. If the underlying database is of type Recno, or of type Btree and the database was created with the Db.DB_RECNUM flag, the count of keys will be exact. Otherwise, the count of keys will be the value saved the last time the database was traversed, or 0 if no count of keys has ever been made. If the underlying database is of type Recno, the count of data items will be exact, otherwise, the count of data items will be the value saved the last time the database was traversed, or 0 if no count of data items has ever been done.

Exceptions:
DbException The Db.stat method may fail and throw DbException, encapsulating one of the following non-zero errors:
IllegalArgumentException The Db.stat method will fail and throw a IllegalArgumentException exception if an invalid flag value or parameter was specified.
Returns:
In the case of a Hash database, the statistics are returned in an instance of DbHashStat. In the case of a Btree or Recno database, the statistics are returned in an instance of DbBtreeStat. In the case of a Queue database, the statistics are returned in an instance of DbQueueStat.

Definition at line 6049 of file Db.java.

                                                     {
        return db_javaJNI.Db_stat(swigCPtr, flags);
    }


Generated by  Doxygen 1.6.0   Back to index