Skip to content
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

Audit for database queries that use firstOrNull instead of a limit #545

Open
4 tasks
nullpointer0x00 opened this issue Sep 17, 2024 · 0 comments
Open
4 tasks

Comments

@nullpointer0x00
Copy link
Contributor

Summary

Audit the codebase for database queries returning large datasets and using firstOrNull on the Kotlin side, which can be optimized by adding limit(1) directly in the database query.

Problem Definition

Some queries were fetching and serializing large datasets, up to 316k records, only to use the first result with firstOrNull. This caused longer query times, unnecessary network data transfer, and serialization overhead. See PR #544 for a related example.

Proposal

Perform an audit to identify and update such queries to include limit(1) where appropriate.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
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

No branches or pull requests

1 participant