mysql count(): optimize requested fields

This commit is contained in:
Alice Gaudon 2020-08-26 14:04:23 +02:00
parent 38a9c6ad15
commit 5930a85617

View File

@ -220,6 +220,7 @@ export default class ModelQuery<M extends Model> {
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;