Skip to content

perf(db-postgres): skip pagination overhead if limit: 0 is passed #12261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2025

Conversation

r1tsuu
Copy link
Member

@r1tsuu r1tsuu commented Apr 29, 2025

This improves performance when querying data in Postgers / SQLite with limit: 0. Before, unless you additionally passed pagination: false we executed additional count query to calculate the pagination. Now we skip this as this is unnecessary since we can retrieve the count just from rows.length.

This logic already existed in db-mongodb -

if (limit >= 0) {
paginationOptions.limit = limit
// limit must also be set here, it's ignored when pagination is false
paginationOptions.options!.limit = limit
// Disable pagination if limit is 0
if (limit === 0) {
paginationOptions.pagination = false
}
}

@r1tsuu r1tsuu merged commit 27d644f into main Apr 30, 2025
81 checks passed
@r1tsuu r1tsuu deleted the perf/skip-pagination-when-limit-0-is-passed branch April 30, 2025 16:31
Copy link
Contributor

🚀 This is included in version v3.36.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants