rappasoft/laravel-livewire-tables

[Bug]: $this->paginationTotalItemCount included on all pagination types. Too heavy for "simple"

booni3 opened this issue · 6 comments

What happened?

I have just upgraded to v3.

I have some tables with nearly 1M rows and some relationships. These worked fine in V2 using simple pagination.

V3 has introduced the code:

if ($this->isPaginationMethod('simple')) {

    $this->paginationTotalItemCount = $this->getBuilder()->count();

    return $this->getBuilder()->simplePaginate($this->getPerPage() === -1 ? $this->paginationTotalItemCount : $this->getPerPage(), ['*'], $this->getComputedPageName());

}

The getBuilder()->count() method is very heavy on big tables. On V2 I did not have the required indexes and tables would load in milliseconds. Without indexes on V3 my tables are timing out with > 30s load time.

After adding some additional indexes, I have gotten load times down between 500ms and 10s... but it is still a big performance from from V2 in this regard.

Do we need to be getting $this->paginationTotalItemCount = $this->getBuilder()->count(); for simple pagination? I thought the whole idea of simple was to make things more performant?

How to reproduce the bug

No response

Package Version

3

PHP Version

8.2.x

Laravel Version

10.34

Alpine Version

No response

Theme

None

Notes

No response

Error Message

No response

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Still interested in this.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.