Skip to content

Eliminate N+1 queries from filtered GeoJSON responses - #184

Merged
andreagrandi merged 1 commit into
masterfrom
fix-geojson-description-n-plus-one
Aug 10, 2026
Merged

Eliminate N+1 queries from filtered GeoJSON responses#184
andreagrandi merged 1 commit into
masterfrom
fix-geojson-description-n-plus-one

Conversation

@andreagrandi

Copy link
Copy Markdown
Owner

Context

Filtered and bounds-based map GeoJSON responses deferred each library description even though serialization reads that field. This caused one additional database query per serialized library and made request cost grow with result size.

What changed

  • Include description in the filtered GeoJSON queryset projection.
  • Add regression coverage for both search-filtered and bounds-based requests.
  • Assert that descriptions remain unchanged and serialization uses a fixed two-query shape.

Notes / constraints

  • The GeoJSON response schema and existing filter behavior are unchanged.
  • No API documentation update is needed because this is a query-loading fix with no contract change.

Testing

  • nox -s tests
  • direnv exec . python manage.py check
  • git diff --check
  • Standalone headed Chromium verification of a city-filtered map request, a bounds-only request, and a marker popup using the returned description; no browser page errors observed.

Closes #178

@andreagrandi
andreagrandi marked this pull request as ready for review August 10, 2026 19:42
@andreagrandi
andreagrandi merged commit 115ce49 into master Aug 10, 2026
3 checks passed
@andreagrandi
andreagrandi deleted the fix-geojson-description-n-plus-one branch August 10, 2026 19:42
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.

Eliminate N+1 queries from filtered GeoJSON responses

1 participant