[Performance]: Join estimates ignore cross-column correlation after ANALYZE (MOTR repro)

Aperta
#33,238 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@jiangxinmeng1 ci sta già lavorando.

Dal 25/11/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

area/optimizer area/performance kind/bug needs-triage

Summary

A deterministic MOTR case on MatrixOne main shows that a multi-table join estimate does not respond when the fact table's joint key distribution changes, even though each join-key column's marginal frequency (including NULL counts) is preserved. This extends the single-column skew issue in #31994 with a distinct cross-column correlation boundary.

Reproduction and evidence

The local MOTR fixture is 10_optimizer.s-4_7.

  • Build 10,000 fact rows: 90% initially use the hot/hot key pair; the remaining rows span 10 regions and 50 customers, with 0.1% NULL join keys.
  • Give both dimension tables duplicate hot keys and NULL-key controls.
  • Move customer values between 1,000 hot-region and 1,000 tail-region rows. This preserves the per-column marginal frequencies but changes their correlation.
  • Run the three-table equi-join before the update, after the update with stale stats, and after ANALYZE TABLE fact.

Observed on MatrixOne main commit ca5325ce683a60ef6d7f0888b68d709de2ea8389:

State EXPLAIN estimated join rows Actual joined rows
Initial hot/hot + tail/tail correlation 2,734.69 36,990
Changed correlation, before ANALYZE 2,734.69 35,960
Changed correlation, after ANALYZE 2,734.69 35,960

SQL results are correct. The estimate is about 13.5x low initially and 13.1x low after the distribution change. Refreshing single-column statistics does not improve it because the marginals are unchanged. Runtime impact has not been measured on a larger workload, so this is a demonstrated cardinality/plan-quality issue, not a confirmed latency regression.

Expected behavior

The optimizer should account for cross-column dependence when estimating joins, or expose conservative uncertainty when available statistics cannot model it. A regression should compare actual rows and plans across correlated and uncorrelated controls without pinning a full EXPLAIN or query-specific join order.

Related issues

  • #31994 — single-column skew and uniform selectivity estimates.
  • #26768 — optimizer roadmap, including multi-column NDV/correlation statistics and join cardinality estimation.
  • Supersedes #33237, which was created under the wrong GitHub identity.

Validation

MOTR 10_optimizer.s-4_7 passed on the main build for baseline recording and a non-recording rerun (27 statements). EXPLAIN output was inspected diagnostically and is not pinned as an exact plan baseline.

Lingua principale
Go
Stelle
1.9k
Fork
312
Merge medio
21h 57m
PR unite (30g)
730

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di matrixorigin/matrixone

Tutte le issue di matrixorigin/matrixone

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.