FilamentF
Filament3y ago
3 replies
Glenn Jacobs

SimplePagination still running a `->count()` query

When using the following code to implement simple pagination (for speed), I note the page still performs a ->count() query on the model.
The point of using simple pagination is to avoid such a query slowing the page down for large amounts of data.

https://filamentphp.com/docs/3.x/tables/advanced#using-simple-pagination

The question is, am I doing this wrong... or have I come across a potential bug?
Solution
Turns out that it wasn't the pagination firing the count() query, it was the table select option for bulk actions.

It can be disabled with the use of $table->selectCurrentPageOnly()
Was this page helpful?