fix: seed a ring from the topic's own keyword index, strongest first - #199
Merged
Conversation
Measured against production (580,383 feeds, 3.5M keyword rows): every candidate query so far was driven by the planner from feeds by status, a probe and sort over every active feed, 80 seconds on the largest topic against a 30-second deadline; the title lookup grouped the slug's rows for seven more. Now the candidates come from feed_keywords_slug_idx (slug, count desc) with the join order pinned, so the statement stops at the hundredth feed that can link; the title is read from the topics rollup that already holds it; the category ranking pool is five times the rings wanted. Ring order is the topic's own, strongest first, still assigned once. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XYae2mH3khdwiXUVzcVMDw
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.
Seed a ring from the topic's own keyword index, strongest first
Follow-up to #198. The poller deployed the category ranking and created seven rings with zero members: every candidate query timed out. Timed read-only against production (
packages/db/scripts/time-ring-queries.mjs, 580,383 feeds, 3,530,106 keyword rows): the planner drove both theexistswalk and the join fromfeeds_status_success_idx, probing and sorting every active feed, 85 s and 80 s on the largest topic; the title lookup 7.4 s; the capped size probe 86 ms.topicRingCandidates:from feed_keywords indexed by feed_keywords_slug_idx cross join feeds,order by k.count desc limit ?. The index is already in that order for a slug, so the scan stops at the hundredth feed that can link. Ring order is now the topic's own (strongest first); positions are still written once and new members append. Fixture given distinct strengths so the ordering test still discriminates.topics.keyword(the rollup already holds it), recomputed only for a topic the rollup lacks.topRingTopics: category count with the same pinned join; pool is 5x the rings wanted.db suite passes.
🤖 Generated with Claude Code
https://claude.ai/code/session_01XYae2mH3khdwiXUVzcVMDw