You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Commit 43d361ff7710f1d5d9af7c86638a9307f1f3f67e (fix(frontend): specialize direct prepared result metadata, #27713) introduces a severe TPCC throughput regression compared with its direct parent c1fe7b4e596c81a023d5cebd1953f388b5bd8500.
Both runs use the same nightly TPCC configuration:
The workload completes without functional test failure, so this presents as a throughput/CPU-allocation regression rather than a correctness failure.
Suspected root cause
High-confidence code inspection points to execute-time prepared-plan specialization work added to the TPCC hot path:
Before 43d361ff, the PREPARE-generation decision needsRuntimeSpecialization was cached and passed to specializePreparedExecutionPlan.
43d361ff repurposes that argument as directResultSpecialization and unconditionally calls PreparedPlanNeedsRuntimeSpecialization(executionPlan) for each execution.
PreparedPlanNeedsRuntimeSpecialization performs DeepCopyPlan plus a full plan/expression walk.
The subsequent parameter-fill path still performs another plan copy/rebind, and replaceParamVals now also calls PreparedPlanDirectResultParamPositions(plan0) during execution.
TPCC repeatedly executes arithmetic prepared DML statements, amplifying these plan copies, walks, allocations, rebinding, compile work, and GC pressure.
The direct-result metadata feature is orthogonal to ordinary TPCC DML. Its admission/tracing should not add per-execution work to that path.
A CPU/alloc pprof from the same nightly environment is still needed to quantify the exact contribution of each new scan/copy, but the direct parent/child benchmark and code-path change establish a strong regression boundary.
Expected behavior
Direct prepared-result metadata specialization must not change the ordinary prepared DML fast path.
Static runtime-specialization eligibility must be computed at most once per prepared-plan generation.
Direct-result parameter positions must be discovered during PREPARE/rebuild and reused, not rediscovered for every execution.
Stable-type repeated prepared DML must reuse its cached plan/compile whenever semantics permit.
Proposed fix direction
Split the cached needsRuntimeSpecialization decision and execute-specific directResultSpecialization into separate explicit inputs; do not overload a boolean with two meanings.
Avoid calling PreparedPlanNeedsRuntimeSpecialization during every execute when the generation-cached result is available.
Keep direct-result propagation/tracing out of generic DML parameter replacement when the prepared plan has no direct result parameters.
Add allocation/CPU benchmarks for repeated TPCC-shaped prepared arithmetic UPDATE statements.
Type changes, NULL, invalid/oversized DECIMAL, compile retry, and prepared-plan rebuild paths remain correct.
Note: the parent revision itself is already below the earlier healthy TPCC baseline. This issue isolates the additional ~77% regression introduced specifically by 43d361ff; removing it does not by itself resolve the earlier regression.
Description
Commit
43d361ff7710f1d5d9af7c86638a9307f1f3f67e(fix(frontend): specialize direct prepared result metadata, #27713) introduces a severe TPCC throughput regression compared with its direct parentc1fe7b4e596c81a023d5cebd1953f388b5bd8500.Both runs use the same nightly TPCC configuration:
Direct comparison
c1fe7b4e596c81a023d5cebd1953f388b5bd850043d361ff7710f1d5d9af7c86638a9307f1f3f67eRegression introduced by
43d361ff:The workload completes without functional test failure, so this presents as a throughput/CPU-allocation regression rather than a correctness failure.
Suspected root cause
High-confidence code inspection points to execute-time prepared-plan specialization work added to the TPCC hot path:
43d361ff, the PREPARE-generation decisionneedsRuntimeSpecializationwas cached and passed tospecializePreparedExecutionPlan.43d361ffrepurposes that argument asdirectResultSpecializationand unconditionally callsPreparedPlanNeedsRuntimeSpecialization(executionPlan)for each execution.PreparedPlanNeedsRuntimeSpecializationperformsDeepCopyPlanplus a full plan/expression walk.replaceParamValsnow also callsPreparedPlanDirectResultParamPositions(plan0)during execution.The direct-result metadata feature is orthogonal to ordinary TPCC DML. Its admission/tracing should not add per-execution work to that path.
A CPU/alloc pprof from the same nightly environment is still needed to quantify the exact contribution of each new scan/copy, but the direct parent/child benchmark and code-path change establish a strong regression boundary.
Expected behavior
Proposed fix direction
needsRuntimeSpecializationdecision and execute-specificdirectResultSpecializationinto separate explicit inputs; do not overload a boolean with two meanings.PreparedPlanNeedsRuntimeSpecializationduring every execute when the generation-cached result is available.SELECT ?metadata correctness, including DECIMAL and binary-protocol unhappy paths.Acceptance criteria
Note: the parent revision itself is already below the earlier healthy TPCC baseline. This issue isolates the additional ~77% regression introduced specifically by
43d361ff; removing it does not by itself resolve the earlier regression.