1
0
Fork 0

show query string length and cacheability in explain output (#9768)

This commit is contained in:
Jan 2019-08-21 18:09:37 +02:00 committed by KVS85
parent 3592af0b79
commit dfafae42b8
2 changed files with 10 additions and 7 deletions

View File

@ -1,6 +1,8 @@
v3.5.1 (XXXX-XX-XX)
-------------------
* Show query string length and cacheability information in query explain output.
* The AQL functions `FULLTEXT`, `NEAR`, `WITHIN` and `WITHIN_RECTANGLE` are now
marked as cacheable, so they can be used in conjunction with the AQL query
results cache on a single server.

View File

@ -162,17 +162,18 @@ function pad(n) {
/* print functions */
/* print query string */
function printQuery(query) {
function printQuery(query, cacheable) {
'use strict';
// restrict max length of printed query to avoid endless printing for
// very long query strings
var maxLength = 4096;
var maxLength = 4096, headline = 'Query String (' + query.length + ' chars';
if (query.length > maxLength) {
stringBuilder.appendLine(section('Query String (truncated):'));
headline += ' - truncated...';
query = query.substr(0, maxLength / 2) + ' ... ' + query.substr(query.length - maxLength / 2);
} else {
stringBuilder.appendLine(section('Query String:'));
}
headline += ', cacheable: ' + (cacheable ? 'true' : 'false');
headline += '):';
stringBuilder.appendLine(section(headline));
stringBuilder.appendLine(' ' + value(stringBuilder.wrap(query, 100)));
stringBuilder.appendLine();
}
@ -700,7 +701,7 @@ function processQuery(query, explain, planIndex) {
if (planIndex !== undefined) {
plan = explain.plans[planIndex];
}
/// mode with actual runtime stats per node
let profileMode = stats && stats.hasOwnProperty('nodes');
@ -1718,7 +1719,7 @@ function processQuery(query, explain, planIndex) {
};
if (planIndex === undefined) {
printQuery(query);
printQuery(query, explain.cacheable);
}
stringBuilder.appendLine(section('Execution plan:'));