Use a much faster query to retrieve the total number of rows in datatables

This should increase performance on part tables
This commit is contained in:
Jan Böhmer 2024-02-25 00:58:26 +01:00
parent 2b65926865
commit b176cb1ae1

View file

@ -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);