Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By naushunaushad on
If we want total record count from a query having pagination we need to run the count query.
I think the PagerDefault class already running a count query.If we can catch this in a member variable then we can avoid the multiple running of the count query.
Here I can explain the details
In includes/pager.inc line 74
$total_items = $this->getCountQuery()->execute()->fetchField();
We can set one public variable and assign $total_items to it.This way we can avoid the multiple running of the count query.
Thanks,
Naushad
Comments
Ok.
Ok.