From 332273fbb0fc4ef557b73d24828545d17c810c20 Mon Sep 17 00:00:00 2001 From: eldenmoon <15605149486@163.com> Date: Mon, 9 Sep 2024 10:37:44 +0800 Subject: [PATCH] [optimize](short circuit) avoid set cacheId when non prepared execute Only set cacheID for prepared statement excute phase, otherwise leading to many redundant cost in BE side --- .../main/java/org/apache/doris/qe/PointQueryExecutor.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/PointQueryExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/PointQueryExecutor.java index dae9a94db3971b..9e4030b768b911 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/PointQueryExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/PointQueryExecutor.java @@ -267,7 +267,10 @@ private RowBatch getNextInternal(Status status, Backend backend) throws TExcepti if (snapshotVisibleVersions != null && !snapshotVisibleVersions.isEmpty()) { requestBuilder.setVersion(snapshotVisibleVersions.get(0)); } - if (shortCircuitQueryContext.cacheID != null) { + // Only set cacheID for prepared statement excute phase, + // otherwise leading to many redundant cost in BE side + if (shortCircuitQueryContext.cacheID != null + && ConnectContext.get().command == MysqlCommand.COM_STMT_EXECUTE) { InternalService.UUID.Builder uuidBuilder = InternalService.UUID.newBuilder(); uuidBuilder.setUuidHigh(shortCircuitQueryContext.cacheID.getMostSignificantBits()); uuidBuilder.setUuidLow(shortCircuitQueryContext.cacheID.getLeastSignificantBits());