Class FBStatisticsManager
- java.lang.Object
-
- org.firebirdsql.management.FBServiceManager
-
- org.firebirdsql.management.FBStatisticsManager
-
- All Implemented Interfaces:
AttachmentProperties,BaseProperties,ServiceConnectionProperties,ServiceManager,StatisticsManager
public class FBStatisticsManager extends FBServiceManager implements StatisticsManager
TheFBStatisticsManagerclass is responsible for replicating the functionality of thegstatcommand-line tool.This functionality includes:
- Retrieving data table statistics
- Retrieving the database header page
- Retrieving index statistics
- Retrieving database logging information
- Retrieving statistics for the data dictionary
- Author:
- Gabriel Reid
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.firebirdsql.management.StatisticsManager
StatisticsManager.DatabaseTransactionInfo
-
-
Field Summary
-
Fields inherited from class org.firebirdsql.management.FBServiceManager
BUFFER_SIZE
-
Fields inherited from interface org.firebirdsql.management.StatisticsManager
DATA_TABLE_STATISTICS, INDEX_STATISTICS, RECORD_VERSION_STATISTICS, SYSTEM_TABLE_STATISTICS
-
-
Constructor Summary
Constructors Constructor Description FBStatisticsManager()Create a new instance ofFBMaintenanceManagerbased on the default GDSType.FBStatisticsManager(java.lang.String gdsType)Create a new instance ofFBMaintenanceManagerbased on a given GDSType.FBStatisticsManager(GDSType gdsType)Create a new instance ofFBMaintenanceManagerbased on a given GDSType.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidgetDatabaseStatistics()Get the full database statistics information, excluding system table information.voidgetDatabaseStatistics(int options)Get specific database statistics.StatisticsManager.DatabaseTransactionInfogetDatabaseTransactionInfo()Get transaction information of the database specified indatabase.static StatisticsManager.DatabaseTransactionInfogetDatabaseTransactionInfo(java.sql.Connection connection)Get transaction information for an existing database connection.voidgetHeaderPage()Fetch the database statistics header page.voidgetTableStatistics(java.lang.String[] tableNames)Get the table statistics.-
Methods inherited from class org.firebirdsql.management.FBServiceManager
attachDatabase, attachServiceManager, connectionPropertyValues, createRequestBuffer, executeServicesOperation, executeServicesOperation, getAuthPlugins, getBooleanProperty, getCharSet, getDatabase, getDbCryptConfig, getExpectedDb, getHost, getIntProperty, getLogger, getPassword, getPort, getPortNumber, getProperty, getServerName, getServerVersion, getServiceName, getUser, getWireCrypt, getWireCryptAsEnum, isWireCompression, queueService, setAuthPlugins, setBooleanProperty, setCharSet, setDatabase, setDbCryptConfig, setExpectedDb, setHost, setIntProperty, setLogger, setPassword, setPort, setPortNumber, setProperty, setServerName, setServiceName, setType, setUser, setWireCompression, setWireCryptAsEnum
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.firebirdsql.jaybird.props.AttachmentProperties
getAuthPlugins, getCharSet, getConnectTimeout, getDbCryptConfig, getEncoding, getPassword, getPortNumber, getProcessId, getProcessName, getRoleName, getServerName, getSocketBufferSize, getSoTimeout, getType, getUser, getWireCrypt, isWireCompression, setAuthPlugins, setCharSet, setConnectTimeout, setDbCryptConfig, setEncoding, setPassword, setPortNumber, setProcessId, setProcessName, setRoleName, setServerName, setSocketBufferSize, setSoTimeout, setType, setUser, setWireCompression, setWireCrypt
-
Methods inherited from interface org.firebirdsql.jaybird.props.BaseProperties
connectionPropertyValues, getBooleanProperty, getBooleanProperty, getIntProperty, getIntProperty, getProperty, getProperty, setBooleanProperty, setIntProperty, setProperty
-
Methods inherited from interface org.firebirdsql.jaybird.props.ServiceConnectionProperties
getExpectedDb, getServiceName, setExpectedDb, setServiceName
-
Methods inherited from interface org.firebirdsql.management.ServiceManager
getDatabase, getHost, getLogger, getPort, getServerVersion, getWireCryptAsEnum, setDatabase, setHost, setLogger, setPort, setWireCryptAsEnum
-
-
-
-
Constructor Detail
-
FBStatisticsManager
public FBStatisticsManager()
Create a new instance ofFBMaintenanceManagerbased on the default GDSType.
-
FBStatisticsManager
public FBStatisticsManager(java.lang.String gdsType)
Create a new instance ofFBMaintenanceManagerbased on a given GDSType.- Parameters:
gdsType- type must be PURE_JAVA, EMBEDDED, or NATIVE
-
FBStatisticsManager
public FBStatisticsManager(GDSType gdsType)
Create a new instance ofFBMaintenanceManagerbased on a given GDSType.- Parameters:
gdsType- The GDS implementation type to use
-
-
Method Detail
-
getHeaderPage
public void getHeaderPage() throws java.sql.SQLExceptionDescription copied from interface:StatisticsManagerFetch the database statistics header page.The header information is written to this
StatisticsManager's logger.- Specified by:
getHeaderPagein interfaceStatisticsManager- Throws:
java.sql.SQLException- if a database access error occurs
-
getDatabaseStatistics
public void getDatabaseStatistics() throws java.sql.SQLExceptionDescription copied from interface:StatisticsManagerGet the full database statistics information, excluding system table information.The statistics information is written to this
StatisticsManager's logger.The listed data includes:
- statistics header page
- log statistics
- index statistics
- data table statistics
Invoking this method is equivalent to the default behaviour of
gstaton the command-line.- Specified by:
getDatabaseStatisticsin interfaceStatisticsManager- Throws:
java.sql.SQLException- if a database access error occurs
-
getDatabaseStatistics
public void getDatabaseStatistics(int options) throws java.sql.SQLExceptionDescription copied from interface:StatisticsManagerGet specific database statistics.The statistics information is written to this
StatisticsManager's logger. All invocations of this method will result in the header page and log data being output.The following options can be supplied as a bitmask:
DATA_TABLE_STATISTICSSYSTEM_TABLE_STATISTICSINDEX_STATISTICSRECORD_VERSION_STATISTICS
If this method is invoked with
0as theoptionsvalue, only the header and log statistics will be output.- Specified by:
getDatabaseStatisticsin interfaceStatisticsManager- Parameters:
options- A bitmask combination ofDATA_TABLE_STATISTICS,SYSTEM_TABLE_STATISTICS,INDEX_STATISTICS, orRECORD_VERSION_STATISTICS. Can also be0, which is equivalent to calling methodStatisticsManager.getDatabaseStatistics()- Throws:
java.sql.SQLException
-
getTableStatistics
public void getTableStatistics(java.lang.String[] tableNames) throws java.sql.SQLExceptionDescription copied from interface:StatisticsManagerGet the table statistics.The statistics information is written to this
StatisticsManager's logger.The listed data includes:
- the primary pointer and index root page numbers
- number of data pages and their average fill
- fill distribution
Invoking this method is equivalent to the behaviour of
gstat -t <table name>on the command-line.- Specified by:
getTableStatisticsin interfaceStatisticsManager- Parameters:
tableNames- array of table names to analyze.- Throws:
java.sql.SQLException- if something went wrong.
-
getDatabaseTransactionInfo
public StatisticsManager.DatabaseTransactionInfo getDatabaseTransactionInfo() throws java.sql.SQLException
Description copied from interface:StatisticsManagerGet transaction information of the database specified indatabase.- Specified by:
getDatabaseTransactionInfoin interfaceStatisticsManager- Returns:
- Database transaction information
- Throws:
java.sql.SQLException- Ifdatabaseis not specified, or for failures to connect or retrieve information
-
getDatabaseTransactionInfo
public static StatisticsManager.DatabaseTransactionInfo getDatabaseTransactionInfo(java.sql.Connection connection) throws java.sql.SQLException
Get transaction information for an existing database connection.- Parameters:
connection- Database connection; must unwrap toFirebirdConnection.- Returns:
- Database transaction information
- Throws:
java.sql.SQLException- Ifconnectiondoes not unwrap toFirebirdConnection, or for failures to retrieve information
-
-