Sunday, 18 June 2017

[Oracle] Oracle JDBC DatabaseMetaData.getIndexInfo() occurs analyze table compute statistics

When I called DatabaseMetaData.getIndexInfo() for checking index, Oracle database was very slow. So, I wonder why oracle is getting slow.



ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) throws SQLException

Retrieves a description of the given table’s indices and statistics. They are ordered by NON_UNIQUE, TYPE, INDEX_NAME, and ORDINAL_POSITION.

Each index column description has the following columns: (snipped)

Parameters:
catalog – a catalog name; must match the catalog name as it is stored in this database; “” retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
schema – a schema name; must match the schema name as it is stored in this database; “” retrieves those without a schema; null means that the schema name should not be used to narrow the search
table – a table name; must match the table name as it is stored in this database
unique – when true, return only indices for unique values; when false, return indices regardless of whether unique or not
approximate – when true, result is allowed to reflect approximate or out of data values; when false, results are requested to be accurate

When this method is called, Oracle JDBC driver execute analyze table statistics.
If approximate is true, execute analyze table schema.table estimate statistics.
On the other hand, if approximate is false, analyze table schema.table compute statistics.

Estimate occurs less overhead than compute. But analyze table makes database slow-down


reference
https://timurakhmadeev.wordpress.com/2010/01/11/databasemetadatagetindexinfo/

No comments:

Post a Comment