Eliminate full-table scan and N+1 queries on leads endpoint

Performancekamo-shared-library
Shipped
March 11, 2026 at 6:48 PM UTC
Author
Kamo
Commit
5fc12c8

- LeadRepository: add findByOrganizationId JPQL query (uses ORG_ID index) instead of loading entire LEADS table and filtering in Java - LeadCustomFormDataRepository: add findByLeadIn for batch loading custom form data for multiple leads in one query - **************** use new repo query; batch-load vendor products with findAllById + map lookup instead of N findById calls - LeadService: add **************** for batch use by the controller For 100 leads this reduces DB queries from ~200 to 3.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing