Query optimization: join prunning and "uniqeness"
维护者通常 5 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start by reading the query transformation and relation metadata code that tracks join conditions and uniqueness; the issue does not name specific files or tests. The proposed optimization also needs a way to determine whether right-side columns are used in the output. Done means safely removing eligible left joins without changing query results; investigate existing tests for join transformations and add coverage for the stated conditions.
由索引模型根据 Issue 内容生成。
描述
Under certain conditions, join transforms could be removed from the query without changing its result. This would have significantly improve query performance.
Example:
from e = employees
join side:left addresses (e.id == that.employee_id)
select {e.name}
... could be simplified into:
from e = employees
select {e.name}
Conditions:
- when there is a join of left relation with right relation,
- and it is a left join (so no left rows are dropped),
- and right relation is unique on the join condition (so no left rows are duplicated),
- and none of the columns from the right relation are used in the output.
At the moment, PRQL does contain knowledge to detect the conditions 1.-3., but not 4., so this is not possible to implement.
It would be possible to have this "uniqueness" information either:
- declared at relation definition site (in SQL terms, this would be a UNIQUE constraint / PRIMARY KEY),
- inferred from the query (if there is a
group x (take 1), we can infer uniqueness onx).
Then, it would be possible to detect condition 4.
- 主要语言
- Rust
- 星标
- 10.9k
- 派生
- 261
- 平均合并
- 4 天 7 小时
- 30 天内合并 PR
- 77
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
PRQL/prql 的其他 Issue
-
Underscore does not work as expected可能已有人在做 @prql-bot 于 6 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 5 天内回复
-
prqlc Debug Report HTML Does Not Escape Source File Name, Enabling Stored XSS via PRQLC_DEBUG_LOG未关闭bug
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 5 天内回复
-
friendliness integrations
难度 2/5 1-3 小时 新手友好度 64/100
PRQL/prql#1636 · 2 条评论 · 2 个 reaction ·
维护者通常 5 天内回复
-
review-runs-tracking
难度 3/5 半天 新手友好度 5/100
维护者通常 5 天内回复
-
Formatted SQL adds spaces inside the next string literal after a string ending in a backslash可能重新可做 关联的 PR 已关闭且未合并。 未关闭bug
难度 4/5 1-2 天 新手友好度 38/100
维护者通常 5 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
RustCrypto/utils#1597 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
max-sixty/worktrunk#4727 · 7 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
follow-up
难度 2/5 1-3 小时 新手友好度 73/100
carrick-sh/carrick#1859 ·
维护者通常 1 天内回复