From b176cb1ae1ef5f809e4a1b0f13354a65289827c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 25 Feb 2024 00:58:26 +0100 Subject: [PATCH] Use a much faster query to retrieve the total number of rows in datatables This should increase performance on part tables --- src/DataTables/PartsDataTable.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/DataTables/PartsDataTable.php b/src/DataTables/PartsDataTable.php index 8a5cd42a..066ae528 100644 --- a/src/DataTables/PartsDataTable.php +++ b/src/DataTables/PartsDataTable.php @@ -208,6 +208,9 @@ final class PartsDataTable implements DataTableTypeInterface 'detail_query' => $this->getDetailQuery(...), 'entity' => Part::class, 'hydrate' => Query::HYDRATE_OBJECT, + //Use the simple total query, as we just want to get the total number of parts without any conditions + //For this the normal query would be pretty slow + 'simple_total_query' => true, 'criteria' => [ function (QueryBuilder $builder) use ($options): void { $this->buildCriteria($builder, $options);