use of org.jkiss.dbeaver.model.exec.plan.DBCQueryPlannerConfiguration in project dbeaver by serge-rider.
the class SQLEditor method explainPlanFromQuery.
private void explainPlanFromQuery(final DBCQueryPlanner planner, final SQLQuery sqlQuery) {
final String[] planQueryString = new String[1];
DBRRunnableWithProgress queryObtainTask = monitor -> {
DBCQueryPlannerConfiguration configuration = ExplainPlanViewer.makeExplainPlanConfiguration(monitor, planner);
if (configuration == null) {
return;
}
try (DBCSession session = getExecutionContext().openSession(monitor, DBCExecutionPurpose.UTIL, "Prepare plan query")) {
DBCPlan plan = planner.planQueryExecution(session, sqlQuery.getText(), configuration);
planQueryString[0] = plan.getPlanQueryString();
} catch (Exception e) {
log.error(e);
}
};
if (RuntimeUtils.runTask(queryObtainTask, "Retrieve plan query", 5000) && !CommonUtils.isEmpty(planQueryString[0])) {
SQLQuery planQuery = new SQLQuery(getDataSource(), planQueryString[0]);
processQueries(Collections.singletonList(planQuery), false, true, false, true, null, null);
}
}
use of org.jkiss.dbeaver.model.exec.plan.DBCQueryPlannerConfiguration in project dbeaver by dbeaver.
the class SQLEditor method explainPlanFromQuery.
private void explainPlanFromQuery(final DBCQueryPlanner planner, final SQLQuery sqlQuery) {
final String[] planQueryString = new String[1];
DBRRunnableWithProgress queryObtainTask = monitor -> {
DBCQueryPlannerConfiguration configuration = ExplainPlanViewer.makeExplainPlanConfiguration(monitor, planner);
if (configuration == null) {
return;
}
try (DBCSession session = getExecutionContext().openSession(monitor, DBCExecutionPurpose.UTIL, "Prepare plan query")) {
DBCPlan plan = planner.planQueryExecution(session, sqlQuery.getText(), configuration);
planQueryString[0] = plan.getPlanQueryString();
} catch (Exception e) {
log.error(e);
}
};
if (RuntimeUtils.runTask(queryObtainTask, "Retrieve plan query", 5000) && !CommonUtils.isEmpty(planQueryString[0])) {
SQLQuery planQuery = new SQLQuery(getDataSource(), planQueryString[0]);
processQueries(Collections.singletonList(planQuery), false, true, false, true, null, null);
}
}
Aggregations