[Bug]
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 40/100
调研方向
Start with src/backend/gpopt/translate/CTranslatorQueryToDXL.cpp and the optimizer_enable_multiple_distinct_aggs definition in guc_gp.c; the issue identifies the guard that causes fallback. Check how the optimizer handles multiple distinct qualified aggregates and review existing tests for that behavior. Done means establishing whether enabling the option is supported and safe, with evidence about plan behavior and the reason it defaults off.
由索引模型根据 Issue 内容生成。
描述
Apache Cloudberry version
Environment
- Cloudberry version:
<Ausgabe von SELECT version(); einfügen> - Segments: 4
optimizer = onjoin_collapse_limit = 20,from_collapse_limit = 20(defaults)
What happened
Environment
- Cloudberry version:
<Ausgabe von SELECT version(); einfügen> - Segments: 4
optimizer = onjoin_collapse_limit = 20,from_collapse_limit = 20(defaults)
Description
A BI tool (Yellowfin) generates queries with several COUNT(DISTINCT ...) on different columns.
GPORCA refuses these queries and falls back to the Postgres-based planner:
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: Feature not supported: Multiple Distinct Qualified Aggregates are disabled in the optimizer
In our case the query joins ~20 tables (LEFT JOINs) with 7 COUNT(DISTINCT ...) and a wide GROUP BY.
After the fallback, the Postgres planner (with join_collapse_limit = 20) needs a very long time to plan:
Planning Time: 192018.556 ms
Optimizer: Postgres query optimizer
Execution Time: 50.880 ms
So the fallback itself turns a trivial query into a ~3 minute planning-only operation.
Questions
- Is this limitation still in place in the latest Cloudberry release, or is there a version where ORCA handles multiple DQAs by default?
- Is it safe/supported to set
optimizer_enable_multiple_distinct_aggs = onin production (e.g. per role), given it is classified as a developer option? Are there known issues or plan-quality regressions (CXformGbAggWithMDQA2Join)? - Is there a reason why the default is
off(performance, correctness)? - Are there recommendations to limit the planning time after an ORCA fallback for queries with many joins (e.g. lowering
join_collapse_limit/from_collapse_limitfor such roles)?
Thanks!
What you think should happen instead
No response
How to reproduce
Minimal reproduction
CREATE TABLE t_mdqa (a int, b int, c int) DISTRIBUTED BY (a);
SET optimizer = on;
SET optimizer_trace_fallback = on;
EXPLAIN SELECT count(DISTINCT a), count(DISTINCT b) FROM t_mdqa GROUP BY c;
-- -> falls back to Postgres-based planner
As far as I can see, the check is still present in current main
(src/backend/gpopt/translate/CTranslatorQueryToDXL.cpp:
if (1 < num_dqa && !optimizer_enable_multiple_distinct_aggs)),
and optimizer_enable_multiple_distinct_aggs is defined as a DEVELOPER_OPTIONS GUC in guc_gp.c.
Operating System
NAME="Red Hat Enterprise Linux" VERSION="8.10 (Ootpa)" ID="rhel" ID_LIKE="fedora" VERSION_ID="8.10" PLATFORM_ID="platform:el8" PRETTY_NAME="Red Hat Enterprise Linux 8.10 (Ootpa)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos" HOME_URL="https://www.redhat.com/" DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8" BUG_REPORT_URL="https://issues.redhat.com/" REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8" REDHAT_BUGZILLA_PRODUCT_VERSION=8.10 REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux" REDHAT_SUPPORT_PRODUCT_VERSION="8.10" Red Hat Enterprise Linux release 8.10 (Ootpa) Red Hat Enterprise Linux release 8.10 (Ootpa)
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.
- 主要语言
- C
- 星标
- 1.4k
- 派生
- 268
- 平均合并
- 4 天 3 小时
- 30 天内合并 PR
- 78
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/cloudberry 的其他 Issue
-
[Bug] Expand fails to recognize user-defined tablespaces可能已有人在做 @nix-oss 于 81 天前认领。 未关闭type: Bug
难度 2/5 1-3 小时 新手友好度 76/100
apache/cloudberry#1885 · 2 个 reaction ·
维护者通常 2 天内回复
-
gpexpand first stage fails: 'SyncPackages' object has no attribute 'ret' (extension sync never runs; regression)可能已有人在做 @talmacschen-arch 于 142 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 86/100
apache/cloudberry#1825 ·
维护者通常 2 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
apache/cloudberry#2257 ·
维护者通常 2 天内回复
-
type: Bug
难度 4/5 3-5 天 新手友好度 48/100
apache/cloudberry#2235 ·
维护者通常 2 天内回复
-
难度 3/5 半天 新手友好度 30/100
apache/cloudberry#2224 ·
维护者通常 2 天内回复
查看 apache/cloudberry 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
-
要トリアージ 辞書
难度 1/5 1-3 小时 新手友好度 86/100
yksr-melt/Meltype#1625 · 1 个 reaction ·
维护者通常 1 天内回复
-
kind/bug priority/medium qa_automation
难度 2/5 1-3 小时 新手友好度 78/100
yugabyte/yugabyte-db#37324 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
tree-sitter/tree-sitter#6111 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
joncampbell123/dosbox-x#6797 ·
维护者通常 1 天内回复