[Bug] Window Sort above ROLLUP gets a larger memory quota and runs slower after "Reserve memory for one partition at a time"
Los mantenedores suelen responder en 2 días
@Alena0704 ya está trabajando en esto.
Desde el 30/11/2026.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 52/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- databases, performance
Línea de trabajo
Start by reading the memory quota change in #2035/#2216 and trace how Append branches and group roots contribute to operator memory limits. The issue identifies the window Sort above ROLLUP as the affected operator; inspect the relevant quota calculation and its tests. Done when memory-intensive operators sum concurrent branch memory while non-memory-intensive operators retain the largest-branch behavior, with the reported quota regression addressed.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Apache Cloudberry version
main and REL_2_STABLE, after "Reserve memory for one partition at a time" (#2035 on REL_2_STABLE, #2216 on main).
What happened
With gp_resqueue_memory_policy = eager_free, the window Sort above a ROLLUP now gets about 2.2x the operatorMem it got before that commit, with the same statement_mem. When the sort spills anyway, the larger quota makes it slower: fewer but bigger in-memory runs, and a bigger last run sorted after all input has arrived.
ORCA turns ROLLUP into an Append of HashAggregates. The commit counts only the largest Append branch, so the window Sort's group counts 1 HashAggregate instead of all of them. But an Agg keeps its hash table until ExecEndAgg() and Append does not release finished branches, so these HashAggregates hold their memory at the same time. Counting one branch is right for the 100kB per partition scan, but not for memory-intensive operators.
TPC-DS 1TB Q67, 64 segments, same plan and settings:
| before the commit | after the commit | |
|---|---|---|
window Sort operatorMem |
1532457kB | 3320324kB |
| spilled | 39152864kB | 39152352kB |
| Q67 execution time | 388 s | 413 s |
What you think should happen instead
Take the largest branch only for non-memory-intensive operators, and keep summing memory-intensive ones (including group roots counted in the parent group). That keeps the fix for many partitions and gives the window Sort its old quota back.
How to reproduce
create table seed (s int) distributed by (s);
insert into seed select generate_series(0, 63);
create table sales (cat int, a int, b int, c int, k int, amt numeric(12,2)) distributed by (k);
insert into sales
select k % 2, k / 1000, k / 100, k / 10, k, (k % 9973) / 100.0
from (select s * 1562500 + g as k from seed, generate_series(1, 1562500) g) x; -- 100M rows
analyze sales;
set optimizer = on;
set statement_mem = '4GB';
set gp_resqueue_print_operator_memory_limits = on;
-- look at the Sort with "Sort Key: cat, (sum(amt)) DESC"
explain (costs off)
select count(*), max(rk)
from (select cat, k, s, rank() over (partition by cat order by s desc) rk
from (select cat, a, b, c, k, sum(amt) s from sales group by rollup (cat, a, b, c, k)) t1) t2;
On 64 segments, the window Sort quota goes from 599086kB to 1397868kB, and the query from about 154 s to 167 s. With statement_mem = 1755MB the quota is back to 598806kB and the time to 157 s.
Operating System
Linux x86_64
Anything else
No response
Are you willing to submit PR?
- Yes, I am willing to submit a PR!
- Lenguaje dominante
- C
- Estrellas
- 1.5k
- Forks
- 280
- Merge medio
- 4 d 21 h
- PR fusionados (30 d)
- 122
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/cloudberry
-
type: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/cloudberry#2459 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
psql tab completion broken for storage servers, tags, profiles and resource groups (pre-PG15 query format)Posiblemente ocupada @allenvox la tomó hace 18 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/cloudberry#2316 ·
Los mantenedores suelen responder en 2 días
-
gpexpand first stage fails: 'SyncPackages' object has no attribute 'ret' (extension sync never runs; regression)Posiblemente ocupada @talmacschen-arch la tomó hace 166 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
apache/cloudberry#1825 ·
Los mantenedores suelen responder en 2 días
-
[Bug] ORCA returns wrong system column values through a partially pruned CTE consumerPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertotype: Bug
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
apache/cloudberry#2458 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
type: Bug
Dificultad 4/5 3-5 días Aptitud para principiantes 56/100
apache/cloudberry#2429 ·
Los mantenedores suelen responder en 2 días
Todos los issues de apache/cloudberry
Issues similares
-
HXsetdir strdup leakAbierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
ly05010419/MacNativeGames#2459 ·
Los mantenedores suelen responder en 1 día
-
2024.2 Backport Required 2025.2 Backport Required 2026.1 Backport Required 2026.2 Backport Required area/build-framework kind/enhancement priority/medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
yugabyte/yugabyte-db#39930 ·
Los mantenedores suelen responder en 1 día
-
RecompLauncher supportAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
shinyquagsire23/OpenJKDF2#540 ·
Los mantenedores suelen responder en 12 días
-
Prison work hall: laundry and kitchen stations stand at bare walls, the hatch has no counter or signAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Life-Framework/Life-Framework#5939 ·
Los mantenedores suelen responder en 1 día