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);
}
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);
}
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);
}
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);
}
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;
}
Aggregations