Add variant_combinations table for efficient matview grouping#3678
Add variant_combinations table for efficient matview grouping#3678mstaeble wants to merge 1 commit into
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: automatic mode |
|
Skipping CI for Draft Pull Request. |
WalkthroughIntroduces a Changesvariant_combinations normalization
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 18 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (18 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mstaeble The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/db/migrations/000003_create_variant_combinations.up.sql`:
- Around line 18-19: Add a real foreign key for the new variant_combination_id
column in the migration so prow_jobs references variant_combinations(id)
directly. Update the CREATE/ALTER logic around the prow_jobs schema change to
include the FK constraint, keeping the column nullable if needed for truly NULL
variants, and make sure the related migration that builds the lookup/index still
works with the enforced relationship.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: cbd519f7-b82a-4f16-b95b-f25a03d4c4e1
📒 Files selected for processing (5)
pkg/db/dailysummary/dailysummary.gopkg/db/migrations/000003_create_variant_combinations.down.sqlpkg/db/migrations/000003_create_variant_combinations.up.sqlpkg/db/models/prow.gopkg/db/views.go
8eb2e21 to
607f388
Compare
|
Scheduling required tests: |
607f388 to
f2a3d1d
Compare
82947a5 to
25ce28c
Compare
Replace TEXT[] array grouping with integer FK lookups in the test report matviews. A new variant_combinations table assigns a SERIAL ID to each unique variants array. A BEFORE INSERT/UPDATE trigger on prow_jobs maintains the FK automatically, requiring no Go loader changes. The test_daily_summaries table gets a denormalized variant_combination_id column, enabling single-stage aggregation in the matview (GROUP BY integer directly) instead of the previous two-stage approach (GROUP BY prow_job_id then collapse by variants). Benchmarked on staging (18K jobs, 45M daily summary rows): - Original matview query (TEXT[] GROUP BY): ~158s - Single-stage (variant_combination_id GROUP BY): ~69s (56% faster) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
25ce28c to
c4936c4
Compare
|
Scheduling required tests: |
|
@mstaeble: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
variant_combinationstable that assigns a SERIAL integer ID to each uniqueprow_jobs.variantsarrayBEFORE INSERT OR UPDATEtrigger onprow_jobsautomatically maintains the FK, requiring no Go loader changesvariant_combination_idintotest_daily_summariesfor single-stage matview aggregationtestReportMatViewdefinition to GROUP BYvariant_combination_id(int4) directly fromtest_daily_summaries, eliminating the previous two-stage aggregation (per-job → per-variant-combo collapse)Benchmark results (staging, 18K jobs, 45M daily summary rows)
Migration details
variant_combinationstable + trigger + backfill (~4.5s on staging)test_daily_summaries(repopulated on next refresh withvariant_combination_idset)syncPostgresMaterializedViewsTest plan
go build ./...andgo test ./pkg/db/...pass🤖 Generated with Claude Code
@coderabbitai ignore