[Bug] MERGE double-counts updated rows when using Split Merge
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 56/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- c, postgresql
- Ambito
- backend-api-design, databases
Direzione di ricerca
Start by tracing how Split Merge represents an UPDATE and how the PostgreSQL planner reports affected rows for MERGE; the issue names no source files or tests, so locate the implementation and existing MERGE regression coverage first. Reproduce the supplied SQL with the PostgreSQL planner on a three-segment cluster, then add regression coverage showing that 20 logical updates report MERGE 20, not MERGE 40.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Apache Cloudberry version
Reported during review of PR #2374, with the PostgreSQL planner on a three-segment cluster.
What happened
A MERGE that updates a distribution key uses Split Merge and reports MERGE 40, although only 20 target rows are updated.
Each target row matches exactly one source row. The reported count appears to include both the DELETE and INSERT halves of each split UPDATE.
What you think should happen instead
No response
How to reproduce
SET optimizer = off;
CREATE TABLE mg AS
SELECT a, 5 b FROM generate_series(1, 20) a
DISTRIBUTED BY (a);
CREATE TABLE mg_ref AS
SELECT generate_series(1, 20) a
DISTRIBUTED BY (a);
EXPLAIN (COSTS OFF)
MERGE INTO mg
USING mg_ref s ON mg.b = s.a
WHEN MATCHED THEN UPDATE SET a = 15;
MERGE INTO mg
USING mg_ref s ON mg.b = s.a
WHEN MATCHED THEN UPDATE SET a = 15;
Both CREATE TABLE statements report:
SELECT 20
The execution plan is:
QUERY PLAN
------------------------------------------------------------------------
Merge on mg
-> Explicit Redistribute Motion 3:3 (slice1; segments: 3)
-> Split Merge
-> Hash Join
Hash Cond: (mg.b = s.a)
-> Redistribute Motion 3:3 (slice2; segments: 3)
Hash Key: mg.b
-> Seq Scan on mg
-> Hash
-> Seq Scan on mg_ref s
Optimizer: Postgres query optimizer
(11 rows)
The MERGE command reports:
MERGE 40
should be:
MERGE 20
All 20 target rows have b = 5 and match the single source row with a = 5. Each logical UPDATE should contribute one affected row, regardless of whether execution splits it into DELETE and INSERT operations.
Operating System
any
Anything else
No response
Are you willing to submit PR?
- Yes, I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct.
- Lingua principale
- C
- Stelle
- 1.5k
- Fork
- 280
- Merge medio
- 4g 21h
- PR unite (30g)
- 122
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/cloudberry
-
type: Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/cloudberry#2459 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
psql tab completion broken for storage servers, tags, profiles and resource groups (pre-PG15 query format)Forse già presa @allenvox l’ha presa 18 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
apache/cloudberry#2316 ·
I maintainer di solito rispondono entro 2 giorni
-
gpexpand first stage fails: 'SyncPackages' object has no attribute 'ret' (extension sync never runs; regression)Forse già presa @talmacschen-arch l’ha presa 166 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
apache/cloudberry#1825 ·
I maintainer di solito rispondono entro 2 giorni
-
[Bug] ORCA returns wrong system column values through a partially pruned CTE consumerForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertatype: Bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
apache/cloudberry#2458 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
[Bug] Window Sort above ROLLUP gets a larger memory quota and runs slower after "Reserve memory for one partition at a time"Forse già presa @Alena0704 l’ha presa 1 giorno fa. Apertatype: Bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
apache/cloudberry#2446 · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di apache/cloudberry
Issue simili
-
HXsetdir strdup leakAperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
ly05010419/MacNativeGames#2459 ·
I maintainer di solito rispondono entro 1 giorno
-
2024.2 Backport Required 2025.2 Backport Required 2026.1 Backport Required 2026.2 Backport Required area/build-framework kind/enhancement priority/medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
yugabyte/yugabyte-db#39930 ·
I maintainer di solito rispondono entro 1 giorno
-
RecompLauncher supportAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
shinyquagsire23/OpenJKDF2#540 ·
I maintainer di solito rispondono entro 12 giorni
-
Prison work hall: laundry and kitchen stations stand at bare walls, the hatch has no counter or signAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Life-Framework/Life-Framework#5939 ·
I maintainer di solito rispondono entro 1 giorno