Repository navigation
perf: cap PoolEffort lookback window to 30 days - #8
Merged
Merged
Conversation
GetEffortBetweenCreatedAsync aggregates SUM() over the shares table since a pool's last block. For pools idle for months, that's an unbounded full-table scan — confirmed via EXPLAIN ANALYZE to cost ~800ms for a pool with no block since 2026-08-08 and 3.15M matching rows, accounting for most of /api/pools' remaining latency after the earlier query-collapsing work. PoolEffort is a display-only ratio stat, so capping the lookback at 30 days (omitting it entirely beyond that) is an acceptable trade-off with no payout impact. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 of 4 tasks
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
GetEffortBetweenCreatedAsyncaggregatesSUM()over thesharestable from a pool's last block to now. For long-dormant pools this is an unbounded full-table scan.EXPLAIN ANALYZEto cost ~800ms for a pool with no block since 2026-08-08 (3.15M matching rows) — this was the dominant remaining latency in/api/poolsafter the earlier query-collapsing work (perf: parallelize and merge /api/pools queries #6, perf: collapse per-pool /api/pools queries into one round trip #7).PoolEffortis a display-only ratio stat (not used in payouts), so this caps the lookback at 30 days and simply omits the value beyond that instead of computing it exactly.Test plan
dotnet build, 0 errors)Get(),GetPoolInfoAsync(),GetSummaryAsync()/api/poolslatency drop for dormant pools (e.g.dgb-odo-solo)🤖 Generated with Claude Code