Repository navigation
Conversation
hnwyllmm
marked this pull request as ready for review
November 30, 2026 02:15
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
(cherry picked from commit b2cea66)
Sort cache records by SQL text so plan size changes do not reorder the expected rows. Preserve the execution counts, cache hits, and SQL text checks.
Keep less memory in the plan arena for ordinary cached SQL. Share immutable metadata, compact plan-owned arrays, and allocate optional scan, DML, and expression metadata only where needed. Built and verified 21 SQL cases and sampled 17 cached plans on the previous master base. Rebased the same patch onto current master and verified patch equivalence and git diff --check.
wangyunlai-seekdb
force-pushed
the
perf/compact-physical-plan-metadata
branch
from
December 1, 2026 12:13
c1d4418 to
40bb7a6
Compare
Reduce cached plan allocations for ordinary queries by compacting ObExpr, moving serialization marks to partial frames, and allocating constant frames, special parameter fields, and partition-wise join constraints only when used. Verified a full SeekDB build and checked the compiled layouts of ObExpr, ObExprFrameInfo, and ObPhysicalPlan. Checked the diff for whitespace errors.
Keep CHECK, foreign key and view checks in ConstraintChecks, and retain specialized index fields only in schemas that have values for them. Preserve the existing encoded field order and the default values. Built the affected SQL code generation, SQL DML and storage targets, checked serialization ordering, and verified the object sizes with DWARF.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
任务描述
减少缓存物理计划和普通 SQL 执行对象的固定内存。计划及运行期对象原先内嵌统计、诊断、分区等数据,编译时还有部分临时分配会跟随计划存活。
解决方案
验证
Linux x86-64 上 master 和当前提交的
//src/observer:seekdb均构建、链接通过。git diff --check通过。当前提交的 GitHub SeekDB CI 通过 300/300 个 SQLTest。GIS 缓存用例按 SQL 文本排序,继续校验执行次数、命中次数和 SQL 文本。整份缓存执行计划内存
在同一 Linux x86-64 隔离环境对比本 PR 的 master 基线
d8dec2590bc0与当前提交c1d44182053a。两边均使用 O2 构建和 sysbench 1.0.20,单线程、每表 2,500 行。每边采到 63 份实际执行的预处理计划,共执行 2,232 条读写 SQL。两边逐条匹配 SQL、算子树和执行次数,均为零忽略错误和零重连。表中每行按该场景的独立计划取平均。已用和持有均来自整份物理计划的 arena,分别表示分配所用字节和分配器持有的页容量。
63 份计划合计持有容量从 3,296.28 KiB 降至 1,232.25 KiB(−62.6%)。算子树一致,计划内的部分执行表达式减少。读写混合场景中的
INSERT从 40 个表达式降至 20 个,其整计划持有容量从 47.16 KiB 降至 23.25 KiB。seekdb_test
当前提交
c1d44182053a的 Linux 定向回归通过,13 个 SQL 用例及 3 项回归任务全部通过。当前结果覆盖所选回归范围。性能回归
在同一 Linux 节点以相同 sysbench 配置,对
master d8dec2590bc0与PR c1d44182053a各做一轮。六个场景均完成,忽略错误和重连为零。读写混合和更新非索引列在六个 10 秒区间中均观察到更高的秒级 P99 中位数。当前只有一对独立构建,尾延迟变化的可重复性和原因待确认。
影响范围
单机 SeekDB 的物理计划生成、缓存与执行,以及同版本 PX 编解码。构建验证覆盖 Linux x86-64。
合入理由
减少普通计划与执行对象的固定占用,让诊断、分区、排序、会话备份等内存随使用路径分配。