From 7d1b99e591970ce9dfa851f43f158f6b92e749be Mon Sep 17 00:00:00 2001 From: lihangyu <15605149486@163.com> Date: Thu, 12 Sep 2024 15:05:49 +0800 Subject: [PATCH] [optimize](short circuit) avoid set cacheId when non prepared execute (#40525) 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 68b1eb6ab9379d..13f6ec2a965f18 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 @@ -234,7 +234,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());