Skip to content

perf: index statistics.created_at for the prune range scan - #57

Merged
DGINXREAL merged 1 commit into
mainfrom
chore/statistics-created-at-index
Jul 31, 2026
Merged

perf: index statistics.created_at for the prune range scan#57
DGINXREAL merged 1 commit into
mainfrom
chore/statistics-created-at-index

Conversation

@DGINXREAL

Copy link
Copy Markdown
Member

Summary

Follow-up to the hardening package (#56). The new daily statistics:prune job scans WHERE created_at < ?, but every existing index on statistics leads with url_id/project_id (statistics_project_created_index, statistics_url_visitor_hash_created_index), so none can serve a bare created_at range — the prune would full-scan the table.

Adds a standalone statistics_created_at_index on created_at, plus a regression test guarding it.

Verification

  • StatisticsCreatedAtIndexTest passes; PruneStatisticsTest still green.
  • Pint clean.

🤖 Generated with Claude Code

The daily statistics:prune job scans WHERE created_at < ?; existing
composite indexes all lead with url_id/project_id and can't serve a bare
created_at range. Adds a standalone index + a regression test. Follow-up
to the hardening package (#56).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@DGINXREAL
DGINXREAL requested a review from noidee-dev as a code owner July 31, 2026 05:25
@DGINXREAL
DGINXREAL merged commit de7f6c5 into main Jul 31, 2026
2 of 3 checks passed
@DGINXREAL
DGINXREAL deleted the chore/statistics-created-at-index branch July 31, 2026 05:28
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