perf(db): query fingerprint metrics and home page query optimization#577
Merged
Conversation
…me page queries - Add fingerprint label to db_query_duration_seconds histogram for identifying slow query shapes - Add skipCount option to ContrailQueryService.find() to avoid unnecessary COUNT(*) scans - Replace ORDER BY RANDOM() in getHomePageFeaturedGroups with two-query ID-then-fetch pattern Addresses consistent 500ms p99 SELECT query duration in production.
3 tasks
tompscanlan
added a commit
that referenced
this pull request
Apr 23, 2026
* revert: remove unreleased features from main, align with prod (v1.5.1) Reverts unreleased features to bring main back in sync with production: - #577 perf(db): query fingerprint + home page optimization - #576 feat: unified AttendanceService - #574 feat(contrail): integrate Contrail appview Hotfix changes (v1.5.1) are retained — they exist in the baseline. All work is preserved on its respective feature branch: - feature/contrail-integration - feature/attendance-service - feature/db-query-performance - feature/contrail-rsvp Direction shift: adopting Contrail/atmo as the new stack rather than integrating Contrail into the OpenMeet API. * fix(test): use future dates in edge-cases spec to avoid past-event guard The hotfix (v1.5.1) added a past-event RSVP guard that rejects RSVPs to events with past start dates. The edge-cases spec used 2024 dates, hitting the guard before reaching the race condition logic under test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
db_query_duration_secondsPrometheus histogram — enables identifying which specific SQL query shapes are slow (fingerprint already computed, just threaded to metric label)skipCountoption toContrailQueryService.find()— guest home page skips the redundant COUNT(*) full table scan since it only random-samples 4 events from 50ORDER BY RANDOM()ingetHomePageFeaturedGroupswith a two-query ID-then-fetch pattern — avoids full table sort with JOINsAddresses consistent 500ms p99 SELECT query duration in production (confirmed via Prometheus: p95=432ms, p99=486ms on SELECT operations).
Relates to: om-otp8, om-kcmj
Test plan
database-metrics.service.spec.ts— 4 new tests for fingerprint labelcontrail-query.service.spec.ts— 3 new tests for skipCount optionevent-query.service.spec.ts— 1 new test for skipCount passthroughgroup.service.spec.ts— 2 new tests for two-query featured groups patterndb_query_duration_seconds