Skip to content

TRT-2848: Drop unused idx_test_daily_totals_date index - #3880

Merged
openshift-merge-bot[bot] merged 2 commits into
openshift:mainfrom
mstaeble:worktree-drop-daily-totals-date-index
Aug 5, 2026
Merged

TRT-2848: Drop unused idx_test_daily_totals_date index#3880
openshift-merge-bot[bot] merged 2 commits into
openshift:mainfrom
mstaeble:worktree-drop-daily-totals-date-index

Conversation

@mstaeble

@mstaeble mstaeble commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Drops idx_test_daily_totals_date, a single-column btree index on test_daily_totals(date) that existed only to make an unscoped SELECT MAX(date) FROM test_daily_totals fast across ~3,700 partitions.
  • TRT-2848: Refresh summary tables incrementally during prow load #3852 (TRT-2848) removed the last two callers of that query pattern (dailysummary.MaxSummaryDate and cumulativesummary.MaxDailySummaryDate), which is why this PR was held until that one merged. With those gone, the index is pure write overhead on every insert into test_daily_totals, with no remaining reader.
  • A full-codebase search confirmed no other query touches date on test_daily_totals/test_cumulative_summaries without a release predicate, so nothing else depends on this index.

Test plan

  • make lint / go build ./pkg/db/...
  • ./hack/verify-migrations.sh passes
  • Applied migration up/down against a fresh Postgres 16 instance seeded with the full migration history; confirmed idx_test_daily_totals_date is dropped on up and exactly recreated on down (verified via \d test_daily_totals)
  • Confirmed against a read-only inspection of staging that the index's current definition (btree (date)) matches what this migration expects to drop/recreate

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated database migrations to remove an unnecessary index and keep the migration history in sync.
    • Added a rollback path to restore the index if needed.

idx_test_daily_totals_date exists only to make an unscoped MAX(date)
fast across ~3,700 partitions. TRT-2848 (PR openshift#3852) removes the last
two callers of that query pattern, so once it merges the index is
pure write overhead. Do not deploy this migration before then, or the
currently-fast MaxSummaryDate/MaxDailySummaryDate calls on main will
regress to a full partition scan.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 5, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 5, 2026

Copy link
Copy Markdown

@mstaeble: This pull request references TRT-2848 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Drops idx_test_daily_totals_date, a single-column btree index on test_daily_totals(date) that existed only to make an unscoped SELECT MAX(date) FROM test_daily_totals fast across ~3,700 partitions.
  • TRT-2848: Refresh summary tables incrementally during prow load #3852 (TRT-2848) removed the last two callers of that query pattern (dailysummary.MaxSummaryDate and cumulativesummary.MaxDailySummaryDate), which is why this PR was held until that one merged. With those gone, the index is pure write overhead on every insert into test_daily_totals, with no remaining reader.
  • A full-codebase search confirmed no other query touches date on test_daily_totals/test_cumulative_summaries without a release predicate, so nothing else depends on this index.

Test plan

  • make lint / go build ./pkg/db/...
  • ./hack/verify-migrations.sh passes
  • Applied migration up/down against a fresh Postgres 16 instance seeded with the full migration history; confirmed idx_test_daily_totals_date is dropped on up and exactly recreated on down (verified via \d test_daily_totals)
  • Confirmed against a read-only inspection of staging that the index's current definition (btree (date)) matches what this migration expects to drop/recreate

🤖 Generated with Claude Code

Instructions 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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 72b64d21-5a59-42b6-b6e1-52985baca8ef

📥 Commits

Reviewing files that changed from the base of the PR and between 602e7eb and 25c9c58.

📒 Files selected for processing (3)
  • pkg/db/migrations/000012_drop_test_daily_totals_date_index.down.sql
  • pkg/db/migrations/000012_drop_test_daily_totals_date_index.up.sql
  • pkg/db/migrations/MANIFEST
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@openshift-ci
openshift-ci Bot requested review from dgoodwin and petr-muller August 5, 2026 15:27
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 5, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e

The "don't deploy before TRT-2848 lands" warning is stale now that
openshift#3852 is merged and this PR is rebased on top of it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
pkg/db/migrations/000012_drop_test_daily_totals_date_index.up.sql (1)

7-7: 🩺 Stability & Availability | 🔵 Trivial

Schedule both directions of this migration around blocking DDL.

The forward migration uses DROP INDEX, which takes an ACCESS EXCLUSIVE lock. The rollback uses normal CREATE INDEX, which blocks table updates while the index builds. Because the migration runner is transactional, concurrent index operations cannot be added without separate runner support.

  • pkg/db/migrations/000012_drop_test_daily_totals_date_index.up.sql#L7-L7: run the drop during a suitable maintenance window.
  • pkg/db/migrations/000012_drop_test_daily_totals_date_index.down.sql#L1-L2: plan rollback for the same write-impact constraint.

Based on learnings, ordinary migrations run transactionally, so concurrent index DDL requires separate runner support.

🤖 Prompt for 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.

In `@pkg/db/migrations/000012_drop_test_daily_totals_date_index.up.sql` at line 7,
Schedule both directions of migration 000012 around a maintenance window: the up
migration’s DROP INDEX requires an ACCESS EXCLUSIVE lock, and the down
migration’s CREATE INDEX blocks table updates. Do not use concurrent index DDL
unless the migration runner is changed to support non-transactional execution;
apply the same write-impact constraint to both
pkg/db/migrations/000012_drop_test_daily_totals_date_index.up.sql lines 7-7 and
pkg/db/migrations/000012_drop_test_daily_totals_date_index.down.sql lines 1-2.

Sources: Learnings, Linters/SAST tools

🤖 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.

Nitpick comments:
In `@pkg/db/migrations/000012_drop_test_daily_totals_date_index.up.sql`:
- Line 7: Schedule both directions of migration 000012 around a maintenance
window: the up migration’s DROP INDEX requires an ACCESS EXCLUSIVE lock, and the
down migration’s CREATE INDEX blocks table updates. Do not use concurrent index
DDL unless the migration runner is changed to support non-transactional
execution; apply the same write-impact constraint to both
pkg/db/migrations/000012_drop_test_daily_totals_date_index.up.sql lines 7-7 and
pkg/db/migrations/000012_drop_test_daily_totals_date_index.down.sql lines 1-2.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 72b64d21-5a59-42b6-b6e1-52985baca8ef

📥 Commits

Reviewing files that changed from the base of the PR and between 602e7eb and 25c9c58.

📒 Files selected for processing (3)
  • pkg/db/migrations/000012_drop_test_daily_totals_date_index.down.sql
  • pkg/db/migrations/000012_drop_test_daily_totals_date_index.up.sql
  • pkg/db/migrations/MANIFEST

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e

@openshift-ci

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@mstaeble: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions 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.

@smg247 smg247 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 5, 2026
@openshift-ci

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mstaeble, smg247

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot
openshift-merge-bot Bot merged commit 3d29301 into openshift:main Aug 5, 2026
10 checks passed
@mstaeble
mstaeble deleted the worktree-drop-daily-totals-date-index branch August 5, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants