Skip to content

General improvement#535

Merged
lenguyenthanh merged 4 commits into
mainfrom
improvement/0
Apr 1, 2026
Merged

General improvement#535
lenguyenthanh merged 4 commits into
mainfrom
improvement/0

Conversation

@lenguyenthanh

Copy link
Copy Markdown
Owner
  • db: add partial indexes on players for active=true query path
  • db: set idle_in_transaction_session_timeout to 30s
  • SQL cleanup, add NM/WNM titles, fix IO purity, and expand test coverage

Drop redundant plain-ASC rating indexes (players_standard/rapid/blitz_idx)
since Postgres can scan the existing DESC NULLS LAST indexes backwards for
ASC queries.

Add WHERE active=true partial indexes for all API-facing queries:
- players_standard_active_idx
- players_rapid_active_idx
- players_blitz_active_idx
- players_federation_id_active_idx

The planner will prefer these smaller, denser indexes over the full
players_*_desc_idx variants whenever the query includes active=true,
which is the case for all public API endpoints.
A Skunk session that crashes mid-transaction could otherwise hold Postgres
locks indefinitely until the pool recycles the connection. 30 s is generous
enough for normal bulk-upsert operations while still providing a safety net.
- V0019 migration: drop redundant cache_key_idx, replace EXCEPTION-based
  AVERAGE with CASE WHEN, convert implicit cross-joins to explicit JOINs
  in federation views, drop 27 redundant indexes on federations_summary,
  document intentional no-FK on player_history.federation_id
- Add NM/WNM to Title enum in both Scala domain and Smithy spec
- Wrap OffsetDateTime.now() in IO in Crawler.fetchAndSave
- Add 40+ new tests: parser edge cases, syncer status logic, player hash
  stability, DB sorting/filtering/batch ops, history rating queries,
  hash-based diffing, and CLI history ingestor integration
@lenguyenthanh lenguyenthanh merged commit d140e49 into main Apr 1, 2026
3 checks passed
@lenguyenthanh lenguyenthanh deleted the improvement/0 branch April 1, 2026 20:03
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.

1 participant