add to log when overviews are being used in dataviews

This commit is contained in:
Eneko Lakasta 2018-08-29 13:50:21 +02:00
parent de30ab99ef
commit 8ef260972d
5 changed files with 13 additions and 6 deletions

View File

@ -64,7 +64,13 @@ DataviewBackend.prototype.getDataview = function (mapConfigProvider, user, param
return callback(err);
}
return callback(null, dataviewResult);
const stats = {};
if (dataviewResult && dataviewResult.usesOverviews) {
stats.usesOverviews = dataviewResult.usesOverviews;
}
return callback(null, dataviewResult, stats);
});
});
};

View File

@ -21,7 +21,7 @@ function getPGTypeName (pgType) {
module.exports = class BaseDataview {
getResult (psql, override, callback) {
this.sql(psql, override, (err, query) => {
this.sql(psql, override, (err, query, flags = { usesOverviews : false }) => {
if (err) {
return callback(err);
}
@ -33,7 +33,8 @@ module.exports = class BaseDataview {
result = this.format(result, override);
result.type = this.getType();
result.usesOverviews = flags.usesOverviews;
return callback(null, result);
}, true); // use read-only transaction

View File

@ -209,7 +209,7 @@ Aggregation.prototype.sql = function(psql, override, callback) {
debug(aggregationSql);
return callback(null, aggregationSql);
return callback(null, aggregationSql, { usesOverviews: true });
};
var aggregationFnQueryTpl = {

View File

@ -74,5 +74,5 @@ Formula.prototype.sql = function (psql, override, callback) {
debug(formulaSql);
return callback(null, formulaSql);
return callback(null, formulaSql, { usesOverviews: true });
};

View File

@ -178,7 +178,7 @@ Histogram.prototype.sql = function(psql, override, callback) {
var histogramSql = this._buildQuery(override);
return callback(null, histogramSql);
return callback(null, histogramSql, { usesOverviews: true });
};
Histogram.prototype._buildQuery = function (override) {