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