Repository navigation
FDirsPerListcoHKdstn: keep today's distribution for the day, warm it (WEBBSITE-46) - #130
Merged
Merged
Conversation
WEBBSITE-46: the default (today) view of the female-director distribution ran its whole-market query on every request; ~0.4 s with a warm buffer cache, it hit the 8 s statement timeout once when cold, while other routes were fast. Today's result is now precomputed per data version and day (_today_or_live, as boardcomp/HKdirsTypeSex do) and in the warm list; other dates stay live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Sentry: WEBBSITE-46 (
dbpub_statistics.fdirsperlistcohkdstn, statement timeout, 1 event at 2026-11-13T00:15Z, no query string, so today's date).Cause. The route ran its whole-market query (listed companies, then directorships and people) on every request with no caching. The production plan is fine: 366 ms, all shared-buffer hits (
scripts/pgq.py --explain). The route's db span p50 is 183 ms and p95 347 ms over 30 days. Other routes were fast at 00:15 (http.server p95 under 240 ms for every transaction in 00:05–00:25), and no other span ran over 3 s, so it was not load. The query reads about 135k buffers (directorships plus a people lookup per director), and with a cold cache that is enough to pass 8 s.Fix. This is the sibling pages' pattern (
boardcomp,HKdirsTypeSex): today's result is precomputed per data version and day with_today_or_live, and/dbpub/FDirsPerListcoHKdstn.aspis in the warm list, so the cold run happens in the warmer and not on a visitor's request. Other dates stay live. I did not add atimeout_soverride, becausetest_perf_budgetcaps the number of overrides and the plan does not need one. The output is unchanged:test_render_paritypasses.Evidence.
tests/test_sentry_regressions.pyfailed withFDirsPerListcoHKdstn today: a repeat is served from the cache: got [None, None], want [], meaning both queries ran again on the repeat request.ruff check .is clean, and CI's DB-free pytest list gives198 passed.🤖 Generated with Claude Code