Add EXPLAIN options for SETTINGS and SUMMARY. Fixes #4335

Prevent flickering of large tooltips on the Graphical EXPLAIN canvas. Fixes #4224
EXPLAIN options should be Query Tool instance-specific. Fixes #4395
This commit is contained in:
Aditya Toshniwal
2019-07-03 13:57:56 +01:00
committed by Dave Page
parent 15556f9f89
commit 0340b8fb28
25 changed files with 425 additions and 249 deletions

View File

@@ -26,6 +26,14 @@ let queryToolActions = {
return !$('.explain-timing').hasClass('visibility-hidden');
},
_summary: function () {
return !$('.explain-summary').hasClass('visibility-hidden');
},
_settings: function () {
return !$('.explain-settings').hasClass('visibility-hidden');
},
_clearMessageTab: function () {
$('.sql-editor-message').html('');
},
@@ -41,36 +49,31 @@ let queryToolActions = {
},
explainAnalyze: function (sqlEditorController) {
let costEnabled = this._costsEnabled();
let verbose = this._verbose();
let buffers = this._buffers();
let timing = this._timing();
const explainObject = {
format: 'json',
analyze: true,
verbose: verbose,
costs: costEnabled,
buffers: buffers,
timing: timing,
summary: false,
verbose: this._verbose(),
costs: this._costsEnabled(),
buffers: this._buffers(),
timing: this._timing(),
summary: this._summary(),
settings: this._settings(),
};
this._clearMessageTab();
sqlEditorController.execute(explainObject);
},
explain: function (sqlEditorController) {
let costEnabled = this._costsEnabled();
let verbose = this._verbose();
// let explainQuery = `EXPLAIN (FORMAT JSON, ANALYZE OFF, VERBOSE ${verbose}, COSTS ${costEnabled}, BUFFERS OFF, TIMING OFF) `;
const explainObject = {
format: 'json',
analyze: false,
verbose: verbose,
costs: costEnabled,
verbose: this._verbose(),
costs: this._costsEnabled(),
buffers: false,
timing: false,
summary: false,
summary: this._summary(),
settings: this._settings(),
};
this._clearMessageTab();
sqlEditorController.execute(explainObject);

View File

@@ -134,6 +134,20 @@ function updateUIPreferences(sqlEditor) {
$el.find('.explain-timing').addClass('visibility-hidden');
}
if (preferences.explain_summary) {
$el.find('.explain-summary').removeClass('visibility-hidden');
}
else {
$el.find('.explain-summary').addClass('visibility-hidden');
}
if (preferences.explain_settings) {
$el.find('.explain-settings').removeClass('visibility-hidden');
}
else {
$el.find('.explain-settings').addClass('visibility-hidden');
}
/* Connection status check */
/* remove the status checker if present */
if(sqlEditor.connIntervalId != null) {