Skip to content

Don't count all rows when using pagination#228

Merged
isakstenstrom merged 1 commit into
buildbarn:mainfrom
meroton:pagination-count-fix
May 4, 2026
Merged

Don't count all rows when using pagination#228
isakstenstrom merged 1 commit into
buildbarn:mainfrom
meroton:pagination-count-fix

Conversation

@isakstenstrom

Copy link
Copy Markdown
Collaborator

NOTE: This is a stacked PR. Please merge #226, #227 first.

Sometimes when calling paginate, Ent needs to do a SELECT COUNT("id") on all rows in a table, but sometimes it does it even when it is not needed. This PR overrides one of the templates Ent uses to generate the pagination function, removing the unnecessary count. For large tables this can be a sizable performance savings.

This should be fixed when ent/contrib#625 is merged.

Ent counts all rows in the table when using pagination, even when it
doesn't need to.
@isakstenstrom isakstenstrom force-pushed the pagination-count-fix branch from 7866ca4 to 13026fc Compare May 4, 2026 08:28
@isakstenstrom isakstenstrom merged commit d1f3d58 into buildbarn:main May 4, 2026
5 checks passed
@isakstenstrom isakstenstrom deleted the pagination-count-fix branch May 4, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants