Skip to content

Commit a6ae0d6

Browse files
Added a flag to disable SimplifiedPlan generation that caused compilation slowdown (ydb-platform#9482)
1 parent 1cb5dfd commit a6ae0d6

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

ydb/core/kqp/compile_service/kqp_compile_actor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ void ApplyServiceConfig(TKikimrConfiguration& kqpConfig, const TTableServiceConf
611611
kqpConfig.IdxLookupJoinsPrefixPointLimit = serviceConfig.GetIdxLookupJoinPointsLimit();
612612
kqpConfig.OldLookupJoinBehaviour = serviceConfig.GetOldLookupJoinBehaviour();
613613
kqpConfig.EnableSpillingGenericQuery = serviceConfig.GetEnableQueryServiceSpilling();
614+
kqpConfig.DisableSimplifiedPlans = serviceConfig.GetDisableSimplifiedPlans();
614615

615616
if (const auto limit = serviceConfig.GetResourceManager().GetMkqlHeavyProgramMemoryLimit()) {
616617
kqpConfig._KqpYqlCombinerMemoryLimit = std::max(1_GB, limit - (limit >> 2U));

ydb/core/kqp/compile_service/kqp_compile_service.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,8 @@ class TKqpCompileService : public TActorBootstrapped<TKqpCompileService> {
537537

538538
bool enableQueryServiceSpilling = TableServiceConfig.GetEnableQueryServiceSpilling();
539539

540+
bool disableSimplifiedPlans = TableServiceConfig.GetDisableSimplifiedPlans();
541+
540542
TableServiceConfig.Swap(event.MutableConfig()->MutableTableServiceConfig());
541543
LOG_INFO(*TlsActivationContext, NKikimrServices::KQP_COMPILE_SERVICE, "Updated config");
542544

@@ -564,7 +566,8 @@ class TKqpCompileService : public TActorBootstrapped<TKqpCompileService> {
564566
TableServiceConfig.GetResourceManager().GetMkqlHeavyProgramMemoryLimit() != mkqlHeavyLimit ||
565567
TableServiceConfig.GetIdxLookupJoinPointsLimit() != idxLookupPointsLimit ||
566568
TableServiceConfig.GetEnableQueryServiceSpilling() != enableQueryServiceSpilling ||
567-
TableServiceConfig.GetEnableImplicitQueryParameterTypes() != enableImplicitQueryParameterTypes) {
569+
TableServiceConfig.GetEnableImplicitQueryParameterTypes() != enableImplicitQueryParameterTypes ||
570+
TableServiceConfig.GetDisableSimplifiedPlans() != disableSimplifiedPlans) {
568571

569572
QueryCache.Clear();
570573

ydb/core/kqp/opt/kqp_query_plan.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2304,7 +2304,12 @@ TString SerializeTxPlans(const TVector<const TString>& txPlans, TIntrusivePtr<NO
23042304
writer.EndObject();
23052305

23062306
auto resultPlan = writer.Str();
2307-
return AddSimplifiedPlan(resultPlan, optCtx, false);
2307+
if (!optCtx || optCtx->Config->DisableSimplifiedPlans) {
2308+
return resultPlan;
2309+
}
2310+
else {
2311+
return AddSimplifiedPlan(resultPlan, optCtx, false);
2312+
}
23082313
}
23092314

23102315
} // namespace
@@ -2700,7 +2705,12 @@ TString AddExecStatsToTxPlan(const TString& txPlanJson, const NYql::NDqProto::TD
27002705
NJsonWriter::TBuf txWriter;
27012706
txWriter.WriteJsonValue(&root, true);
27022707
auto resultPlan = txWriter.Str();
2703-
return AddSimplifiedPlan(resultPlan, optCtx, true);
2708+
if (!optCtx || optCtx->Config->DisableSimplifiedPlans) {
2709+
return resultPlan;
2710+
}
2711+
else {
2712+
return AddSimplifiedPlan(resultPlan, optCtx, true);
2713+
}
27042714
}
27052715

27062716
TString AddExecStatsToTxPlan(const TString& txPlanJson, const NYql::NDqProto::TDqExecutionStats& stats) {

ydb/core/kqp/provider/yql_kikimr_settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ struct TKikimrConfiguration : public TKikimrSettings, public NCommon::TSettingDi
169169
bool EnableOltpSink = false;
170170
NKikimrConfig::TTableServiceConfig_EBlockChannelsMode BlockChannelsMode;
171171
bool EnableSpillingGenericQuery = false;
172+
bool DisableSimplifiedPlans = false;
172173
};
173174

174175
}

ydb/core/protos/table_service_config.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,4 +304,7 @@ message TTableServiceConfig {
304304
optional bool EnableQueryServiceSpilling = 63 [ default = true ];
305305

306306
optional bool EnableImplicitQueryParameterTypes = 66 [ default = false ];
307+
308+
optional bool DisableSimplifiedPlans = 67 [ default = false ];
309+
307310
};

0 commit comments

Comments
 (0)