This is an automated email from the ASF dual-hosted git repository.

dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 7e1bff9970 [INLONG-9846][Manager] Optimize slow query SQL (#9847)
7e1bff9970 is described below

commit 7e1bff9970cf29931010b1c186df8c1d34597084
Author: fuweng11 <[email protected]>
AuthorDate: Tue Mar 19 19:23:22 2024 +0800

    [INLONG-9846][Manager] Optimize slow query SQL (#9847)
---
 .../main/resources/mappers/DataNodeEntityMapper.xml  | 20 ++++++++++----------
 .../resources/mappers/InlongGroupEntityMapper.xml    |  4 ++--
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git 
a/inlong-manager/manager-dao/src/main/resources/mappers/DataNodeEntityMapper.xml
 
b/inlong-manager/manager-dao/src/main/resources/mappers/DataNodeEntityMapper.xml
index f5cbe7aff3..7e62cb562a 100644
--- 
a/inlong-manager/manager-dao/src/main/resources/mappers/DataNodeEntityMapper.xml
+++ 
b/inlong-manager/manager-dao/src/main/resources/mappers/DataNodeEntityMapper.xml
@@ -65,11 +65,11 @@
         <include refid="Base_Column_List"/>
         from data_node
         <where>
+            id = #{id, jdbcType=INTEGER}
             <if test="_isInlongService == false">
-                tenant = #{tenant,jdbcType=VARCHAR}
+                and tenant = #{tenant,jdbcType=VARCHAR}
             </if>
             and is_deleted = 0
-            and id = #{id, jdbcType=INTEGER}
         </where>
     </select>
     <select id="selectByUniqueKey" 
resultType="org.apache.inlong.manager.dao.entity.DataNodeEntity">
@@ -78,12 +78,12 @@
         <include refid="Base_Column_List"/>
         from data_node
         <where>
+            name = #{name, jdbcType=VARCHAR}
+            and type = #{type, jdbcType=VARCHAR}
+            and is_deleted = 0
             <if test="_isInlongService == false">
-                tenant = #{tenant,jdbcType=VARCHAR}
+                and tenant = #{tenant,jdbcType=VARCHAR}
             </if>
-            and is_deleted = 0
-            and name = #{name, jdbcType=VARCHAR}
-            and type = #{type, jdbcType=VARCHAR}
         </where>
     </select>
     <select id="selectByCondition"
@@ -94,10 +94,6 @@
         <include refid="Base_Column_List"/>
         from data_node
         <where>
-            <if test="_isInlongService == false">
-                tenant = #{tenant,jdbcType=VARCHAR}
-            </if>
-            and is_deleted = 0
             <if test="name != null and name != ''">
                 and name = #{name, jdbcType=VARCHAR}
             </if>
@@ -115,6 +111,10 @@
             <if test="status != null and status != ''">
                 and status = #{status, jdbcType=INTEGER}
             </if>
+            <if test="_isInlongService == false">
+                and tenant = #{tenant,jdbcType=VARCHAR}
+            </if>
+            and is_deleted = 0
         </where>
         order by modify_time desc
     </select>
diff --git 
a/inlong-manager/manager-dao/src/main/resources/mappers/InlongGroupEntityMapper.xml
 
b/inlong-manager/manager-dao/src/main/resources/mappers/InlongGroupEntityMapper.xml
index 4d373f0002..b97475c58f 100644
--- 
a/inlong-manager/manager-dao/src/main/resources/mappers/InlongGroupEntityMapper.xml
+++ 
b/inlong-manager/manager-dao/src/main/resources/mappers/InlongGroupEntityMapper.xml
@@ -241,10 +241,10 @@
         from inlong_group
         <where>
             inlong_group_id = #{groupId, jdbcType=VARCHAR}
+            and is_deleted = 0
             <if test="_isInlongService == false">
                 and tenant = #{tenant,jdbcType=VARCHAR}
             </if>
-            and is_deleted = 0
         </where>
     </select>
     <select id="selectByGroupIdForUpdate" resultMap="BaseResultMap">
@@ -254,10 +254,10 @@
         from inlong_group
         <where>
             inlong_group_id = #{groupId, jdbcType=VARCHAR}
+            and is_deleted = 0
             <if test="_isInlongService == false">
                 and tenant = #{tenant,jdbcType=VARCHAR}
             </if>
-            and is_deleted = 0
         </where>
          for update
     </select>

Reply via email to