Search in sources :

Example 1 with XPLAINScanPropsDescriptor

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

the class XPLAINSystemTableVisitor method addArraysToSystemCatalogs.

/**
 * This method writes the created descriptor arrays
 * to the cooresponding system catalogs.
 */
private void addArraysToSystemCatalogs() throws StandardException, SQLException {
    boolean statsSave = lcc.getRunTimeStatisticsMode();
    lcc.setRunTimeStatisticsMode(false);
    Connection conn = getDefaultConn();
    PreparedStatement ps = conn.prepareStatement((String) lcc.getXplainStatement("SYSXPLAIN_RESULTSETS"));
    Iterator<XPLAINResultSetDescriptor> rsetsiter = rsets.iterator();
    while (rsetsiter.hasNext()) {
        XPLAINResultSetDescriptor rset = rsetsiter.next();
        rset.setStatementParameters(ps);
        ps.executeUpdate();
    }
    ps.close();
    // add the resultset timings descriptors, if timing is on
    if (considerTimingInformation) {
        ps = conn.prepareStatement((String) lcc.getXplainStatement("SYSXPLAIN_RESULTSET_TIMINGS"));
        Iterator<Object> timingsiter = rsetsTimings.iterator();
        while (timingsiter.hasNext()) {
            XPLAINResultSetTimingsDescriptor rsetT = (XPLAINResultSetTimingsDescriptor) timingsiter.next();
            rsetT.setStatementParameters(ps);
            ps.executeUpdate();
        }
        ps.close();
    }
    ps = conn.prepareStatement((String) lcc.getXplainStatement("SYSXPLAIN_SCAN_PROPS"));
    Iterator<XPLAINScanPropsDescriptor> scaniter = scanrsets.iterator();
    while (scaniter.hasNext()) {
        XPLAINScanPropsDescriptor scanProps = scaniter.next();
        scanProps.setStatementParameters(ps);
        ps.executeUpdate();
    }
    ps.close();
    ps = conn.prepareStatement((String) lcc.getXplainStatement("SYSXPLAIN_SORT_PROPS"));
    Iterator<XPLAINSortPropsDescriptor> sortiter = sortrsets.iterator();
    while (sortiter.hasNext()) {
        XPLAINSortPropsDescriptor sortProps = sortiter.next();
        sortProps.setStatementParameters(ps);
        ps.executeUpdate();
    }
    ps.close();
    conn.close();
    lcc.setRunTimeStatisticsMode(statsSave);
}
Also used : XPLAINResultSetDescriptor(org.apache.derby.impl.sql.catalog.XPLAINResultSetDescriptor) XPLAINScanPropsDescriptor(org.apache.derby.impl.sql.catalog.XPLAINScanPropsDescriptor) Connection(java.sql.Connection) PreparedStatement(java.sql.PreparedStatement) XPLAINResultSetTimingsDescriptor(org.apache.derby.impl.sql.catalog.XPLAINResultSetTimingsDescriptor) XPLAINSortPropsDescriptor(org.apache.derby.impl.sql.catalog.XPLAINSortPropsDescriptor)

Example 2 with XPLAINScanPropsDescriptor

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

the class XPLAINSystemTableVisitor method visit.

/**
 * Visit this node, calling back to it to get details.
 *
 * This method visits the RS Statisitcs node, calling back to the
 * node to get detailed descriptor information about it.
 */
public void visit(ResultSetStatistics statistics) {
    UUID timingID = null;
    if (considerTimingInformation) {
        timingID = dd.getUUIDFactory().createUUID();
        rsetsTimings.add(statistics.getResultSetTimingsDescriptor(timingID));
    }
    UUID sortID = dd.getUUIDFactory().createUUID();
    XPLAINSortPropsDescriptor sortRSDescriptor = (XPLAINSortPropsDescriptor) statistics.getSortPropsDescriptor(sortID);
    if (sortRSDescriptor != null)
        sortrsets.add(sortRSDescriptor);
    else
        sortID = null;
    UUID scanID = dd.getUUIDFactory().createUUID();
    XPLAINScanPropsDescriptor scanRSDescriptor = (XPLAINScanPropsDescriptor) statistics.getScanPropsDescriptor(scanID);
    if (scanRSDescriptor != null)
        scanrsets.add(scanRSDescriptor);
    else
        scanID = null;
    UUID rsID = dd.getUUIDFactory().createUUID();
    rsets.add((XPLAINResultSetDescriptor) statistics.getResultSetDescriptor(rsID, UUIDStack.empty() ? (UUID) null : UUIDStack.pop(), scanID, sortID, stmtUUID, timingID));
    pushUUIDnoChildren(rsID);
}
Also used : XPLAINSortPropsDescriptor(org.apache.derby.impl.sql.catalog.XPLAINSortPropsDescriptor) XPLAINScanPropsDescriptor(org.apache.derby.impl.sql.catalog.XPLAINScanPropsDescriptor) UUID(org.apache.derby.catalog.UUID)

Example 3 with XPLAINScanPropsDescriptor

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

the class RealHashTableStatistics method getScanPropsDescriptor.

public Object getScanPropsDescriptor(Object scanPropsID) {
    FormatableProperties props = this.scanProperties;
    String isoLevel = XPLAINUtil.getIsolationLevelCode(this.isolationLevel);
    String hashkey_columns = XPLAINUtil.getHashKeyColumnNumberString(this.hashKeyColumns);
    // create new scan info descriptor with some basic information
    XPLAINScanPropsDescriptor scanRSDescriptor = new XPLAINScanPropsDescriptor(// the scan props UUID
    (UUID) scanPropsID, // the index/table name
    "Temporary HashTable", // the scan object, either (C)onstraint, (I)ndex or (T)able
    null, // 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, // the fetch size
    null, // the start position, internal encoding
    null, // the stop position, internal encoding
    null, // the scan qualifiers
    null, // the next qualifiers
    this.nextQualifiers, // the hash key column numbers
    hashkey_columns, // the hash table size
    this.hashtableSize);
    // fill additional information from scan properties
    return XPLAINUtil.extractScanProps(scanRSDescriptor, props);
}
Also used : XPLAINScanPropsDescriptor(org.apache.derby.impl.sql.catalog.XPLAINScanPropsDescriptor) FormatableProperties(org.apache.derby.iapi.services.io.FormatableProperties)

Example 4 with XPLAINScanPropsDescriptor

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

the class RealHashScanStatistics 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);
    String hashkey_columns = XPLAINUtil.getHashKeyColumnNumberString(this.hashKeyColumns);
    XPLAINScanPropsDescriptor scanRSDescriptor = new XPLAINScanPropsDescriptor(// the scan props UUID
    (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, // the fetch size
    null, this.startPosition, this.stopPosition, this.scanQualifiers, this.nextQualifiers, hashkey_columns, this.hashtableSize);
    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 5 with XPLAINScanPropsDescriptor

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

the class RealLastIndexKeyScanStatistics method getScanPropsDescriptor.

public Object getScanPropsDescriptor(Object scanPropsID) {
    String isoLevel = XPLAINUtil.getIsolationLevelCode(this.isolationLevel);
    XPLAINScanPropsDescriptor scanRSDescriptor = new XPLAINScanPropsDescriptor(// the scan props UUID
    (UUID) scanPropsID, this.indexName, "I", // 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, // the fetch size
    null, // the start position, internal encoding
    null, // the stop position, internal encoding
    null, // the scan qualifiers
    null, // the next qualifiers
    null, // the hash key column numbers
    null, // the hash table size
    null);
    return scanRSDescriptor;
}
Also used : XPLAINScanPropsDescriptor(org.apache.derby.impl.sql.catalog.XPLAINScanPropsDescriptor)

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