From 5930a8561786c5423f5c2224fd0fed8560f5937c Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Wed, 26 Aug 2020 14:04:23 +0200 Subject: [PATCH] mysql count(): optimize requested fields --- src/db/ModelQuery.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/db/ModelQuery.ts b/src/db/ModelQuery.ts index 13c7452..883252c 100644 --- a/src/db/ModelQuery.ts +++ b/src/db/ModelQuery.ts @@ -220,6 +220,7 @@ export default class ModelQuery { this._sortBy = undefined; this._sortDirection = undefined; + this.fields.splice(0, this.fields.length); this.fields.push('COUNT(*)'); let queryResult = await this.execute(connection); return queryResult.results.length;