Skip to content

Combined CR query with materialized CTEs - #3884

Open
mstaeble wants to merge 2 commits into
openshift:mainfrom
mstaeble:combined-cr-query-poc
Open

Combined CR query with materialized CTEs#3884
mstaeble wants to merge 2 commits into
openshift:mainfrom
mstaeble:combined-cr-query-poc

Conversation

@mstaeble

@mstaeble mstaeble commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Folds sample and base component_readiness queries into a single SQL statement using two materialized CTEs and UNION ALL branches, eliminating duplicate query planning and table scans.
  • Simplifies getTestStatus orchestration: the combined query returns both sides in one call, removing goroutine/channel coordination for the common case.
  • Adds comprehensive GenerateReport integration tests covering prefix-sum aggregation, GA path, mixed lifecycle filtering, disjoint variants between base and sample, capabilities array-overlap filtering, and grid placeholder merging.

Benchmark results

Tested locally against the staging database (3 runs each, averaged, with warm-up):

Scenario Baseline Combined Speedup
5.0-main 8.57s 4.19s 2.04x
4.22-main 6.91s 2.91s 2.37x
5.0-rosa 0.57s 0.77s 0.74x
5.0-hypershift 1.01s 1.02s 0.99x
5.0-ha-vs-single 5.21s 2.04s 2.55x
5.0-x86-vs-arm 9.14s 3.55s 2.57x
Etcd-filter 8.34s 4.19s 1.99x
Platform-aws 5.29s 3.63s 1.45x
ColGroupBy-Topology 8.27s 4.18s 1.97x
test_details drilldown 0.80s 0.76s 1.05x

The combined query provides ~2x speedup on large views and up to 2.6x on cross-variant views. Small views (ROSA, Hypershift) with fewer variant groups show no meaningful change. The test_details drilldown path (which still uses the standalone query) is not regressed.

Test plan

  • Existing integration tests pass (make integration)
  • New GenerateReport_* and TestCapabilitiesArrayOverlapFilter integration tests pass
  • Benchmark against staging to verify combined query performance matches or improves on standalone
  • Verify test_details drill-down path still works (standalone query path)
  • Verify releasefallback middleware still works (uses QueryBaseTestStatus)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved component-readiness report accuracy for release isolation, lifecycle filtering, variant comparisons, missing data, and minimum-failure thresholds.
    • Improved handling of overlapping and disjoint capability variants.
    • Prevented partial or failed status retrievals from producing misleading results.
  • Performance

    • Streamlined status collection to improve report generation efficiency.
  • Observability

    • Added structured completion details, including report duration and result counts.

@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 openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 6, 2026
@openshift-ci

openshift-ci Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci

openshift-ci Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mstaeble

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-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 6, 2026
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro Plus

Run ID: 2dd914f6-e59d-4023-b58c-4107fca4c5b3

📥 Commits

Reviewing files that changed from the base of the PR and between ee2c819 and 5fdcc5e.

📒 Files selected for processing (2)
  • pkg/api/componentreadiness/dataprovider/postgres/cr_queries.go
  • test/integration/component_readiness_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/api/componentreadiness/dataprovider/postgres/cr_queries.go
  • test/integration/component_readiness_test.go

Walkthrough

The component readiness report now retrieves base and sample statuses through one provider API. Providers return both result maps and aggregated errors. Middleware queries use a shared wait group and error channel. PostgreSQL combines status queries, and integration coverage expands.

Changes

Component readiness status flow

Layer / File(s) Summary
Status and middleware contracts
pkg/api/componentreadiness/dataprovider/..., pkg/api/componentreadiness/middleware/...
QueryTestStatus returns base and sample status maps with errors. Middleware queries no longer receive status channels.
Provider status retrieval
pkg/api/componentreadiness/dataprovider/bigquery/provider.go, pkg/api/componentreadiness/dataprovider/mixed/provider.go, pkg/api/componentreadiness/dataprovider/postgres/provider.go
BigQuery runs base and sample queries concurrently. Mixed and PostgreSQL providers forward or return both status maps through QueryTestStatus.
Combined PostgreSQL query implementation
pkg/api/componentreadiness/dataprovider/postgres/cr_queries.go
PostgreSQL uses shared aggregation specifications and CTEs. One combined query scans source-tagged base and sample rows, separates results, merges placeholders, and builds status records.
Report integration and validation
pkg/api/componentreadiness/component_report.go, test/integration/component_readiness_test.go
GenerateReport coordinates provider and middleware queries with shared synchronization. Integration tests cover query results, capability filtering, lifecycle data, release isolation, variant comparisons, missing data, regressions, GA data, and failure thresholds.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GenerateReport
  participant MiddlewareList
  participant TestStatusQuerier
  participant PostgresProvider
  participant PostgreSQL
  GenerateReport->>TestStatusQuerier: QueryTestStatus(ctx, requestOptions)
  GenerateReport->>MiddlewareList: Query(ctx, waitGroup, errorChannel)
  MiddlewareList-->>GenerateReport: Middleware errors
  TestStatusQuerier->>PostgresProvider: QueryTestStatus(ctx, requestOptions)
  PostgresProvider->>PostgreSQL: Execute combined base and sample query
  PostgreSQL-->>PostgresProvider: Source-tagged status rows
  PostgresProvider-->>TestStatusQuerier: Base and sample status maps
  TestStatusQuerier-->>GenerateReport: Status maps and query errors
Loading

Possibly related PRs

  • openshift/sippy#3716: Both changes modify component-readiness test-status querying and release-date handling.

Suggested reviewers: dgoodwin, sosiouxme

🚥 Pre-merge checks | ✅ 17 | ❌ 4

❌ Failed checks (4 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Coverage For New Features ⚠️ Warning Integration tests cover end-to-end QueryTestStatus, but new pure helpers buildInnerAggregation, buildStatusCTE, prefixSumSpec, gaSpec, mergePlaceholders, and buildTestStatus have no direct unit tests. Add PostgreSQL unit tests for each pure helper, including SQL/argument construction, GA and prefix specifications, placeholder merging, and TestStatus mapping.
Single Responsibility And Clear Naming ⚠️ Warning queryCombinedTestStatus spans 183 lines and handles date/spec selection, variant lookup, SQL construction, scanning, classification, and merging; its local combinedRow has 11 fields. Split queryCombinedTestStatus into focused helpers for option/date setup, SQL construction, row scanning/classification, and placeholder merging; use focused row types where practical.
Test Structure And Quality ⚠️ Warning New integration tests contain message-less assertions, including require.Empty(t, errs) at lines 3561 and 3608 and assert.Equal at lines 3569 and 3612, which weakens failure diagnosis. Add behavior-specific messages to new error, length, nil, and result assertions, for example require.Empty(t, errs, "GenerateReport returned errors").
✅ Passed checks (17 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: combining component-readiness queries with materialized CTEs.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Go Error Handling ✅ Passed Changed paths aggregate provider and middleware errors; new database failures use fmt.Errorf with %w. No new panic calls, unchecked error assignments, or unsafe pointer dereferences were found.
Sql Injection Prevention ✅ Passed New PostgreSQL status queries bind request values through placeholders, and dynamic SQL fragments use constants or numeric database-derived mappings; BigQuery status queries use named parameters.
Excessive Css In React Should Use Styles ✅ Passed The PR changes only Go backend and integration-test files. It adds no React components or inline CSS that requires useStyles.
Feature Documentation ✅ Passed The PR changes component-readiness query internals and APIs, but docs/features has no component-readiness document; documentation updates are encouraged, not required.
Stable And Deterministic Test Names ✅ Passed The changed tests use standard Go Test and literal t.Run names; no Ginkgo titles or dynamic pod, node, namespace, timestamp, UUID, IP, or generated values appear.
Microshift Test Compatibility ✅ Passed The PR adds Go integration tests under test/integration using testing.T, testify, and database fixtures; it adds no Ginkgo e2e tests or OpenShift API/resource usage.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The PR adds only standard Go integration tests with testing.T; no Ginkgo e2e tests or multi-node/SNO topology assumptions were added.
Topology-Aware Scheduling Compatibility ✅ Passed The PR changes only 13 Go files under componentreadiness and tests; no manifests, controllers, operators, or scheduling constraints are modified.
Ote Binary Stdout Contract ✅ Passed The PR adds no process-level stdout writes or suite setup. New logging uses logrus, which defaults to stderr; the changed init only assigns a function and emits no output.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The only changed test file uses standard testing.T tests, not Ginkgo e2e tests. Added tests use database fixtures and contain no IPv4 addresses, URL/network calls, or external services.
No-Weak-Crypto ✅ Passed The pull request adds no MD5, SHA1, DES, RC4, 3DES, Blowfish, ECB, crypto API, custom crypto, or secret/token comparisons.
Container-Privileges ✅ Passed The PR changes only Go and integration-test files; its diff adds no privileged, host namespace, SYS_ADMIN, or allowPrivilegeEscalation settings.
No-Sensitive-Data-In-Logs ✅ Passed New logging records only durations, aggregate counts, row counts, and static side labels; it does not log passwords, tokens, API keys, PII, hostnames, or customer identifiers.
✨ 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.

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

Actionable comments posted: 2

🧹 Nitpick comments (4)
pkg/api/componentreadiness/dataprovider/postgres/cr_queries.go (4)

434-451: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reuse prepareVariantQuery instead of re-implementing it per side.

Lines 416-451 repeat the body of prepareVariantQuery twice: lookupVariantValues, buildVariantFilterClause, and the SELECT vc.id FROM variant_combinations vc [WHERE ...] assembly. prowJobJoinTemplate also duplicates the join string that queryTestStatus builds inline at lines 246-250. Any future change to the variant filter or the prow job join must be applied in two places.

Extract the per-side setup into a helper that both queryTestStatus and queryCombinedTestStatus call, and promote the prow job join to a package-level constant.

♻️ Proposed shape
const prowJobJoinTemplate = `JOIN prow_jobs pj ON pj.id = e.prow_job_id
                AND pj.deleted_at IS NULL
                AND pj.variant_combination_id IN (%s)
            JOIN vg ON vg.vcid = pj.variant_combination_id`

// variantSide holds the per-side variant resolution used by the combined query.
type variantSide struct {
	lookup     map[uint]map[string]string
	filterArgs []any
	prowJobJoin string
}

func resolveVariantSide(ctx context.Context, dbc *db.DB, includeVariants map[string][]string, dbGroupBy sets.Set[string]) (variantSide, error) {
	lookup, err := lookupVariantValues(ctx, dbc, includeVariants, dbGroupBy)
	if err != nil {
		return variantSide{}, err
	}
	filterClause, filterArgs := buildVariantFilterClause(includeVariants)
	subquery := "SELECT vc.id FROM variant_combinations vc"
	if filterClause != "" {
		subquery += " WHERE " + filterClause
	}
	return variantSide{
		lookup:      lookup,
		filterArgs:  filterArgs,
		prowJobJoin: fmt.Sprintf(prowJobJoinTemplate, subquery),
	}, nil
}
🤖 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/api/componentreadiness/dataprovider/postgres/cr_queries.go` around lines
434 - 451, Extract the repeated variant-side setup into a shared
resolveVariantSide helper and package-level prowJobJoinTemplate. Update both
queryTestStatus and queryCombinedTestStatus to use the helper for lookup values,
filter arguments, subquery construction, and Prow job joins, preserving existing
error propagation and query behavior.

555-568: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Pass the side as a log field, not as part of the message.

mergePlaceholders formats label into the message with Infof while the counts use WithField. This makes the log line hard to filter by side. Use a field for the side and a constant message.

♻️ Proposed change
-	log.WithField("placeholders", len(placeholders)).
+	log.WithField("side", label).
+		WithField("placeholders", len(placeholders)).
 		WithField("merged", merged).
 		WithField("failures", len(failures)-merged).
 		WithField("total", len(failures)).
-		Infof("combined query: %s placeholder merge complete", label)
+		Info("combined query: placeholder merge complete")

As per coding guidelines: "Prefer structured logging where appropriate, especially for names and IDs, and prefer log.WithField() over formatting values into strings."

🤖 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/api/componentreadiness/dataprovider/postgres/cr_queries.go` around lines
555 - 568, Update mergePlaceholders to add label as a structured log field via
WithField, and replace the Infof call with a constant message using Info. Keep
the existing placeholder, merged, failures, and total fields unchanged.

Source: Coding guidelines


501-536: 🚀 Performance & Scalability | 🔵 Trivial | 🏗️ Heavy lift

Stream the combined rows instead of materializing the full union.

tx.Raw(...).Scan(&allRows) builds the complete result slice before the split loop runs. The union now carries both sides, so peak memory holds every sample row plus every base row as combinedRow values, in addition to the four result maps. The comment in pkg/api/componentreadiness/component_report.go at line 318 records a production base result count of 133132 rows, so the combined slice can reach a few hundred thousand structs, each holding several strings and a pq.StringArray.

scanRows at line 596 already streams with .Rows() and inserts directly into the map. Use the same approach here and add the source column, so the intermediate slice disappears and the row-to-TestStatus conversion is defined once.

♻️ Proposed streaming shape
-		var allRows []combinedRow
-		if qErr := tx.Raw(fullSQL, allArgs...).Scan(&allRows).Error; qErr != nil {
-			return fmt.Errorf("querying combined test status: %w", qErr)
-		}
-
 		sampleFailures := make(map[string]crstatus.TestStatus)
 		samplePlaceholders := make(map[string]crstatus.TestStatus)
 		baseFailures := make(map[string]crstatus.TestStatus)
 		basePlaceholders := make(map[string]crstatus.TestStatus)
 
 		scanStart := time.Now()
-		for _, row := range allRows {
+		rows, qErr := tx.Raw(fullSQL, allArgs...).Rows()
+		if qErr != nil {
+			return fmt.Errorf("querying combined test status: %w", qErr)
+		}
+		defer rows.Close()
+
+		rowCount := 0
+		for rows.Next() {
+			var row combinedRow
+			if err := rows.Scan(
+				&row.Source, &row.TestID, &row.TestName, &row.TestSuite,
+				&row.Component, &row.Capabilities, &row.VariantGroupID,
+				&row.TotalCount, &row.SuccessCount, &row.FlakeCount, &row.LastFailure,
+			); err != nil {
+				return fmt.Errorf("scanning combined row: %w", err)
+			}
+			rowCount++
 			variantMap := groupMapping.groupToVariants[row.VariantGroupID]

Then check rows.Err() after the loop and log rowCount instead of len(allRows).

🤖 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/api/componentreadiness/dataprovider/postgres/cr_queries.go` around lines
501 - 536, Replace the `tx.Raw(fullSQL, allArgs...).Scan(&allRows)`
materialization in the combined-row processing flow with `Rows()`, selecting the
`source` column and scanning each row into `combinedRow` as it streams. Reuse
one row-to-`TestStatus` conversion path while inserting directly into the four
maps, close the rows, check `rows.Err()`, and track/log a `rowCount` instead of
using `len(allRows)`; follow the existing `scanRows` pattern.

34-35: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Avoid disabling PostgreSQL planner methods globally.

enable_sort = off and enable_nestloop = off are planner diagnostics; PostgreSQL still uses sort or nested-loop paths when they are the only viable option, but with a different cost/selection model. These hints apply to the whole transaction, so prefer targeting only the queries that need them and document EXPLAIN (ANALYZE, BUFFERS) results for both versions.

🤖 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/api/componentreadiness/dataprovider/postgres/cr_queries.go` around lines
34 - 35, Update queryPlannerHints to remove the global enable_sort and
enable_nestloop planner overrides, and apply any needed planner settings only to
the specific queries that require them. Validate the affected queries with
EXPLAIN (ANALYZE, BUFFERS) both with and without those settings, and document
the comparison.
🤖 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/api/componentreadiness/dataprovider/postgres/cr_queries.go`:
- Around line 416-426: Replace the combined len(sampleLookup) || len(baseLookup)
early return in the surrounding query function with independent handling for
sampleLookup and baseLookup. Preserve non-empty results for either side,
returning an empty sample or base map only when that side’s own lookup is empty,
and reuse the already-resolved sampleRange without resolving it again.

In `@test/integration/component_readiness_test.go`:
- Around line 3764-3767: Update the assertions for the shared component rows in
the test cases around findReportRow and findReportColumn, including the
duplicate case near the “not MissingSample/MissingBasis” comment, to explicitly
reject both crtest.MissingBasis and crtest.MissingSample. Replace the current
lower-bound assertion with checks that the status is neither missing condition,
preserving the intent that shared data is assessed normally.

---

Nitpick comments:
In `@pkg/api/componentreadiness/dataprovider/postgres/cr_queries.go`:
- Around line 434-451: Extract the repeated variant-side setup into a shared
resolveVariantSide helper and package-level prowJobJoinTemplate. Update both
queryTestStatus and queryCombinedTestStatus to use the helper for lookup values,
filter arguments, subquery construction, and Prow job joins, preserving existing
error propagation and query behavior.
- Around line 555-568: Update mergePlaceholders to add label as a structured log
field via WithField, and replace the Infof call with a constant message using
Info. Keep the existing placeholder, merged, failures, and total fields
unchanged.
- Around line 501-536: Replace the `tx.Raw(fullSQL, allArgs...).Scan(&allRows)`
materialization in the combined-row processing flow with `Rows()`, selecting the
`source` column and scanning each row into `combinedRow` as it streams. Reuse
one row-to-`TestStatus` conversion path while inserting directly into the four
maps, close the rows, check `rows.Err()`, and track/log a `rowCount` instead of
using `len(allRows)`; follow the existing `scanRows` pattern.
- Around line 34-35: Update queryPlannerHints to remove the global enable_sort
and enable_nestloop planner overrides, and apply any needed planner settings
only to the specific queries that require them. Validate the affected queries
with EXPLAIN (ANALYZE, BUFFERS) both with and without those settings, and
document the comparison.
🪄 Autofix

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: Pro Plus

Run ID: 00dffccd-b446-4f47-92e1-1abfd96aaf8d

📥 Commits

Reviewing files that changed from the base of the PR and between ff252ad and 0703b9a.

📒 Files selected for processing (13)
  • pkg/api/componentreadiness/component_report.go
  • pkg/api/componentreadiness/dataprovider/bigquery/provider.go
  • pkg/api/componentreadiness/dataprovider/interface.go
  • pkg/api/componentreadiness/dataprovider/mixed/provider.go
  • pkg/api/componentreadiness/dataprovider/postgres/cr_queries.go
  • pkg/api/componentreadiness/dataprovider/postgres/provider.go
  • pkg/api/componentreadiness/middleware/interface.go
  • pkg/api/componentreadiness/middleware/linkinjector/linkinjector.go
  • pkg/api/componentreadiness/middleware/list.go
  • pkg/api/componentreadiness/middleware/regressionallowances/regressionallowances.go
  • pkg/api/componentreadiness/middleware/regressiontracker/regressiontracker.go
  • pkg/api/componentreadiness/middleware/releasefallback/releasefallback.go
  • test/integration/component_readiness_test.go

Comment thread pkg/api/componentreadiness/dataprovider/postgres/cr_queries.go
Comment thread test/integration/component_readiness_test.go
@mstaeble
mstaeble force-pushed the combined-cr-query-poc branch from 0703b9a to ee2c819 Compare August 6, 2026 22:26
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@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 6, 2026
@mstaeble
mstaeble marked this pull request as ready for review August 7, 2026 16:21
@mstaeble mstaeble changed the title [WIP] Combined CR query with materialized CTEs Combined CR query with materialized CTEs Aug 7, 2026
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 7, 2026
@openshift-ci
openshift-ci Bot requested review from dgoodwin and sosiouxme August 7, 2026 16:21
mstaeble and others added 2 commits August 7, 2026 13:11
Exercise the full GenerateReport pipeline (combined query path) with 9
test scenarios: no regression, regression detection, cross-release
isolation, missing sample/basis, variant grouping collapse, cross-variant
compare, GA base path, lifecycle filtering, and minimum failure threshold.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fold the separate sample and base queries into a single SQL statement
with two materialized CTEs (sample_agg, base_agg) joined via UNION ALL.
This eliminates the concurrent partition scans that cause buffer cache
contention when sample and base queries run in parallel.

The postgres provider now implements CombinedTestStatusQuerier, which
GenerateReport prefers over the separate QueryBase/QuerySample path.
Cross-variant compare, GA base windows, lifecycle filtering, and
drilldown filters are all supported in the combined path.

Also fixes a bug where the sample CTE unconditionally applied a
lifecycle filter (AND e.lifecycle = ANY(?)), causing zero sample results
when no lifecycle was specified. The filter is now conditional, matching
the behavior of the separate query path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mstaeble
mstaeble force-pushed the combined-cr-query-poc branch from ee2c819 to 5fdcc5e Compare August 7, 2026 17:15
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e

@openshift-ci

openshift-ci Bot commented Aug 7, 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.

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

1 participant