Skip to content

[PERF-2D] Rewrite lists endpoint: SQL aggregation + cache #116

Description

@Franc3s-bot

Rewrite /api/lists for SQL aggregation

Context

Current: loads all 96K rows → Python loops → 16s. Target: SQL GROUP BY → 200ms.

Tasks

  • Rewrite aggregate_list_stats to use SQL GROUP BY with jsonb functions
  • Use text-based signature for SQL grouping, compute full signature in Python only for final results
  • Push faction/min_games/points filters to SQL WHERE (remove post-aggregation Python filtering)
  • Wrap with get_cached_or_compute()
  • Keep same API response shape (no frontend changes)
  • Delete or skip analytics/new_lists.py (dead code)
  • Update any tests that mock aggregate_list_stats

Acceptance criteria

  • /api/lists response time <200ms uncached
  • Same response data as before (no regression)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions