Search in sources :

Example 6 with XPLAINScanPropsDescriptor

use of org.apache.derby.impl.sql.catalog.XPLAINScanPropsDescriptor in project derby by apache.

the class RealTableScanStatistics method getScanPropsDescriptor.

public Object getScanPropsDescriptor(Object scanPropsID) {
    String scanObjectType, scanObjectName;
    if (this.indexName != null) {
        if (this.isConstraint) {
            // constraint
            scanObjectType = "C";
            scanObjectName = this.indexName;
        } else {
            // index
            scanObjectType = "I";
            scanObjectName = this.indexName;
        }
    } else {
        // table
        scanObjectType = "T";
        scanObjectName = this.tableName;
    }
    String isoLevel = XPLAINUtil.getIsolationLevelCode(this.isolationLevel);
    XPLAINScanPropsDescriptor scanRSDescriptor = new XPLAINScanPropsDescriptor((UUID) scanPropsID, scanObjectName, scanObjectType, // the scan type: heap, btree, sort
    null, // the isolation level
    isoLevel, // the number of visited pages
    null, // the number of visited rows
    null, // the number of qualified rows
    null, // the number of visited deleted rows
    null, // the number of fetched columns
    null, // the bitset of fetched columns
    null, // the btree height
    null, this.fetchSize, this.startPosition, this.stopPosition, this.qualifiers, // the next qualifiers
    null, // the hash key column numbers
    null, // the hash table size
    null);
    FormatableProperties props = this.scanProperties;
    return XPLAINUtil.extractScanProps(scanRSDescriptor, props);
}
Also used : XPLAINScanPropsDescriptor(org.apache.derby.impl.sql.catalog.XPLAINScanPropsDescriptor) FormatableProperties(org.apache.derby.iapi.services.io.FormatableProperties)

Example 7 with XPLAINScanPropsDescriptor

use of org.apache.derby.impl.sql.catalog.XPLAINScanPropsDescriptor in project derby by apache.

the class SystemProcedures method SYSCS_SET_XPLAIN_SCHEMA.

/**
 * This procedure sets the current xplain schema.
 * If the schema is not set, runtime statistics are captured as a
 * textual stream printout. If it is set, statisitcs information is
 * stored in that schema in user tables.
 * @param schemaName May be an empty string.
 * @throws SQLException
 */
public static void SYSCS_SET_XPLAIN_SCHEMA(String schemaName) throws SQLException, StandardException {
    try {
        // make sure that application code doesn't bypass security checks
        // by calling this public entry point
        SecurityUtil.authorize(Securable.SET_XPLAIN_SCHEMA);
    } catch (StandardException se) {
        throw PublicAPI.wrapStandardException(se);
    }
    LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC();
    TransactionController tc = lcc.getTransactionExecute();
    if (schemaName == null || schemaName.trim().length() == 0) {
        lcc.setXplainSchema(null);
        return;
    }
    boolean statsSave = lcc.getRunTimeStatisticsMode();
    lcc.setRunTimeStatisticsMode(false);
    createXplainSchema(schemaName);
    createXplainTable(lcc, schemaName, new XPLAINStatementDescriptor());
    createXplainTable(lcc, schemaName, new XPLAINStatementTimingsDescriptor());
    createXplainTable(lcc, schemaName, new XPLAINResultSetDescriptor());
    createXplainTable(lcc, schemaName, new XPLAINResultSetTimingsDescriptor());
    createXplainTable(lcc, schemaName, new XPLAINScanPropsDescriptor());
    createXplainTable(lcc, schemaName, new XPLAINSortPropsDescriptor());
    lcc.setRunTimeStatisticsMode(statsSave);
    lcc.setXplainSchema(schemaName);
}
Also used : StandardException(org.apache.derby.shared.common.error.StandardException) XPLAINSortPropsDescriptor(org.apache.derby.impl.sql.catalog.XPLAINSortPropsDescriptor) XPLAINStatementDescriptor(org.apache.derby.impl.sql.catalog.XPLAINStatementDescriptor) XPLAINResultSetDescriptor(org.apache.derby.impl.sql.catalog.XPLAINResultSetDescriptor) LanguageConnectionContext(org.apache.derby.iapi.sql.conn.LanguageConnectionContext) XPLAINScanPropsDescriptor(org.apache.derby.impl.sql.catalog.XPLAINScanPropsDescriptor) XPLAINStatementTimingsDescriptor(org.apache.derby.impl.sql.catalog.XPLAINStatementTimingsDescriptor) TransactionController(org.apache.derby.iapi.store.access.TransactionController) XPLAINResultSetTimingsDescriptor(org.apache.derby.impl.sql.catalog.XPLAINResultSetTimingsDescriptor)

Aggregations

XPLAINScanPropsDescriptor (org.apache.derby.impl.sql.catalog.XPLAINScanPropsDescriptor)7 FormatableProperties (org.apache.derby.iapi.services.io.FormatableProperties)3 XPLAINSortPropsDescriptor (org.apache.derby.impl.sql.catalog.XPLAINSortPropsDescriptor)3 XPLAINResultSetDescriptor (org.apache.derby.impl.sql.catalog.XPLAINResultSetDescriptor)2 XPLAINResultSetTimingsDescriptor (org.apache.derby.impl.sql.catalog.XPLAINResultSetTimingsDescriptor)2 Connection (java.sql.Connection)1 PreparedStatement (java.sql.PreparedStatement)1 UUID (org.apache.derby.catalog.UUID)1 LanguageConnectionContext (org.apache.derby.iapi.sql.conn.LanguageConnectionContext)1 TransactionController (org.apache.derby.iapi.store.access.TransactionController)1 XPLAINStatementDescriptor (org.apache.derby.impl.sql.catalog.XPLAINStatementDescriptor)1 XPLAINStatementTimingsDescriptor (org.apache.derby.impl.sql.catalog.XPLAINStatementTimingsDescriptor)1 StandardException (org.apache.derby.shared.common.error.StandardException)1