Skip to content

chore(clickhouse): add projection for events table#2375

Merged
sitole merged 5 commits intomainfrom
chore/add-clickhouse-events-projection
Apr 14, 2026
Merged

chore(clickhouse): add projection for events table#2375
sitole merged 5 commits intomainfrom
chore/add-clickhouse-events-projection

Conversation

@jakubno
Copy link
Copy Markdown
Member

@jakubno jakubno commented Apr 13, 2026

This should prevent full table scans on sandbox_events: Queries filtering by sandbox_team_id required scanning a lot of rows because the table is ordered by (sandbox_id, timestamp). Added a projection with (sandbox_team_id, timestamp) ordering so these queries use an efficient index lookup.

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 13, 2026

PR Summary

Medium Risk
Adds and materializes a new ClickHouse projection and drops an existing index on a large events table; the migration could be resource-intensive and impact query/ingest performance while it runs.

Overview
Adds a temporary ClickHouse projection on sandbox_events_local ordered by (sandbox_team_id, timestamp) to speed up team-filtered queries, materializes it immediately, and removes the now-redundant idx_team_id bloom-filter index (with a down migration that restores the index and drops the projection).

Reviewed by Cursor Bugbot for commit e2cbbd7. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f5815c3. Configure here.

@sitole sitole self-assigned this Apr 13, 2026
@sitole sitole self-requested a review April 14, 2026 07:36
@sitole sitole merged commit 361a2ef into main Apr 14, 2026
45 checks passed
@sitole sitole deleted the chore/add-clickhouse-events-projection branch April 14, 2026 11:22
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.

3 participants