You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ta...@apache.org on 2023/04/24 15:25:26 UTC

[iotdb] branch master updated: [IOTDB-5567] improve show cluster slots information (#9665)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new d92ea6e77c [IOTDB-5567] improve show cluster slots information (#9665)
d92ea6e77c is described below

commit d92ea6e77c623890b78cdbbaac058c75c70c5647
Author: YuFengLiu <38...@users.noreply.github.com>
AuthorDate: Mon Apr 24 23:25:19 2023 +0800

    [IOTDB-5567] improve show cluster slots information (#9665)
---
 .../org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4   |  25 ++-
 .../antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4  |   8 +-
 .../consensus/request/ConfigPhysicalPlan.java      |   6 +-
 .../consensus/request/ConfigPhysicalPlanType.java  |   2 +
 ...lotListPlan.java => CountTimeSlotListPlan.java} |  52 ++++--
 .../read/partition/GetSeriesSlotListPlan.java      |  18 +--
 .../read/partition/GetTimeSlotListPlan.java        |  44 +++--
 .../request/read/region/GetRegionIdPlan.java       |  46 +++---
 ...egionIdResp.java => CountTimeSlotListResp.java} |  19 +--
 .../response/partition/GetRegionIdResp.java        |   2 +-
 .../response/partition/GetSeriesSlotListResp.java  |   2 +-
 .../response/partition/GetTimeSlotListResp.java    |   2 +-
 .../iotdb/confignode/manager/ConfigManager.java    |  22 ++-
 .../apache/iotdb/confignode/manager/IManager.java  |  35 +++-
 .../manager/consensus/ConsensusManager.java        |  12 +-
 .../manager/partition/PartitionManager.java        |  60 +++++--
 .../persistence/executor/ConfigPlanExecutor.java   |   3 +
 .../partition/DatabasePartitionTable.java          |  23 +--
 .../persistence/partition/PartitionInfo.java       | 128 +++++++++++++--
 .../thrift/ConfigNodeRPCServiceProcessor.java      |  47 +++---
 .../request/ConfigPhysicalPlanSerDeTest.java       |  17 +-
 docs/UserGuide/Cluster/Cluster-Maintenance.md      | 176 +++++++++++++++-----
 docs/zh/UserGuide/Cluster/Cluster-Maintenance.md   | 177 ++++++++++++++++-----
 .../it/partition/IoTDBPartitionGetterIT.java       |  96 +++++------
 .../commons/partition/DataPartitionTable.java      |  45 ++++--
 .../commons/partition/SchemaPartitionTable.java    |  10 ++
 .../commons/partition/SeriesPartitionTable.java    |  32 ++--
 .../apache/iotdb/db/client/ConfigNodeClient.java   |  22 +++
 .../db/mpp/common/header/ColumnHeaderConstant.java |  11 +-
 .../db/mpp/common/header/DatasetHeaderFactory.java |   4 +
 .../plan/execution/config/ConfigTaskVisitor.java   |   7 +
 .../config/executor/ClusterConfigTaskExecutor.java |  71 +++++++--
 .../config/executor/IConfigTaskExecutor.java       |   4 +
 ...lotListTask.java => CountTimeSlotListTask.java} |  38 ++---
 .../config/metadata/GetTimeSlotListTask.java       |   9 +-
 .../iotdb/db/mpp/plan/parser/ASTVisitor.java       |  86 ++++++----
 .../db/mpp/plan/statement/StatementVisitor.java    |   6 +
 ...tement.java => CountTimeSlotListStatement.java} |  59 ++++---
 .../statement/metadata/GetRegionIdStatement.java   |  54 +++----
 .../metadata/GetSeriesSlotListStatement.java       |  20 +--
 .../metadata/GetTimeSlotListStatement.java         |  46 ++++--
 .../src/main/thrift/confignode.thrift              |  36 +++--
 42 files changed, 1093 insertions(+), 489 deletions(-)

diff --git a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4 b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
index 5da25971ce..0f4df03ce7 100644
--- a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
+++ b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
@@ -58,7 +58,7 @@ ddlStatement
     | createContinuousQuery | dropContinuousQuery | showContinuousQueries
     // Cluster
     | showVariables | showCluster | showRegions | showDataNodes | showConfigNodes
-    | getRegionId | getTimeSlotList | getSeriesSlotList | migrateRegion
+    | getRegionId | getTimeSlotList | countTimeSlotList | getSeriesSlotList | migrateRegion
     // ML Model
     | createModel | dropModel | showModels | showTrails
     // Quota
@@ -454,23 +454,36 @@ showConfigNodes
 
 // ---- Get Region Id
 getRegionId
-    : SHOW (DATA|SCHEMA) REGIONID OF path=prefixPath WHERE (SERIESSLOTID operator_eq
-        seriesSlot=INTEGER_LITERAL|DEVICEID operator_eq deviceId=prefixPath) (OPERATOR_AND (TIMESLOTID operator_eq timeSlot=INTEGER_LITERAL|
-        TIMESTAMP operator_eq timeStamp=INTEGER_LITERAL))?
+    : SHOW (DATA|SCHEMA) REGIONID WHERE (DATABASE operator_eq database=prefixPath
+        |DEVICE operator_eq device=prefixPath)
+        (OPERATOR_AND (TIMESTAMP|TIME) operator_eq time = timeValue)?
     ;
 
 // ---- Get Time Slot List
 getTimeSlotList
-    : SHOW TIMESLOTID OF path=prefixPath WHERE SERIESSLOTID operator_eq seriesSlot=INTEGER_LITERAL
+    : SHOW (TIMESLOTID|TIMEPARTITION) WHERE (DEVICE operator_eq device=prefixPath
+        | REGIONID operator_eq regionId=INTEGER_LITERAL
+        | DATABASE operator_eq database=prefixPath )
+        (OPERATOR_AND STARTTIME operator_eq startTime=timeValue)?
+        (OPERATOR_AND ENDTIME operator_eq endTime=timeValue)?
+    ;
+
+// ---- Count Time Slot List
+countTimeSlotList
+    : COUNT (TIMESLOTID|TIMEPARTITION) WHERE (DEVICE operator_eq device=prefixPath
+        | REGIONID operator_eq regionId=INTEGER_LITERAL
+        | DATABASE operator_eq database=prefixPath )
         (OPERATOR_AND STARTTIME operator_eq startTime=INTEGER_LITERAL)?
         (OPERATOR_AND ENDTIME operator_eq endTime=INTEGER_LITERAL)?
     ;
 
 // ---- Get Series Slot List
 getSeriesSlotList
-    : SHOW (DATA|SCHEMA)? SERIESSLOTID OF path=prefixPath
+    : SHOW (DATA|SCHEMA) SERIESSLOTID WHERE DATABASE operator_eq database=prefixPath
     ;
 
+
+
 // ---- Migrate Region
 migrateRegion
     : MIGRATE REGION regionId=INTEGER_LITERAL FROM fromId=INTEGER_LITERAL TO toId=INTEGER_LITERAL
diff --git a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4 b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4
index 8a16b9e7d0..d9eefda093 100644
--- a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4
+++ b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4
@@ -226,10 +226,6 @@ DEVICE
     : D E V I C E
     ;
 
-DEVICEID
-    : D E V I C E I D
-    ;
-
 DEVICES
     : D E V I C E S
     ;
@@ -710,6 +706,10 @@ TIMESLOTID
     : T I M E S L O T I D
     ;
 
+TIMEPARTITION
+    : T I M E P A R T I T I O N
+    ;
+
 TIMESTAMP
     : T I M E S T A M P
     ;
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlan.java b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlan.java
index fc0e0fd225..7664ce4629 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlan.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlan.java
@@ -26,6 +26,7 @@ import org.apache.iotdb.confignode.consensus.request.read.datanode.GetDataNodeCo
 import org.apache.iotdb.confignode.consensus.request.read.function.GetFunctionTablePlan;
 import org.apache.iotdb.confignode.consensus.request.read.model.ShowModelPlan;
 import org.apache.iotdb.confignode.consensus.request.read.model.ShowTrailPlan;
+import org.apache.iotdb.confignode.consensus.request.read.partition.CountTimeSlotListPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetDataPartitionPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetNodePathsPartitionPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetOrCreateDataPartitionPlan;
@@ -127,7 +128,7 @@ public abstract class ConfigPhysicalPlan implements IConsensusRequest {
 
   private final ConfigPhysicalPlanType type;
 
-  public ConfigPhysicalPlan(ConfigPhysicalPlanType type) {
+  protected ConfigPhysicalPlan(ConfigPhysicalPlanType type) {
     this.type = type;
   }
 
@@ -393,6 +394,9 @@ public abstract class ConfigPhysicalPlan implements IConsensusRequest {
         case GetTimeSlotList:
           plan = new GetTimeSlotListPlan();
           break;
+        case CountTimeSlotList:
+          plan = new CountTimeSlotListPlan();
+          break;
         case GetSeriesSlotList:
           plan = new GetSeriesSlotListPlan();
           break;
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanType.java b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanType.java
index 9b88ca9414..5da7ce05e3 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanType.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanType.java
@@ -59,6 +59,8 @@ public enum ConfigPhysicalPlanType {
   GetTimeSlotList((short) 308),
   PollSpecificRegionMaintainTask((short) 309),
 
+  CountTimeSlotList((short) 310),
+
   /** Partition */
   GetSchemaPartition((short) 400),
   CreateSchemaPartition((short) 401),
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetTimeSlotListPlan.java b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/CountTimeSlotListPlan.java
similarity index 66%
copy from confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetTimeSlotListPlan.java
copy to confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/CountTimeSlotListPlan.java
index dc36c50151..94663e45fb 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetTimeSlotListPlan.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/CountTimeSlotListPlan.java
@@ -19,6 +19,8 @@
 
 package org.apache.iotdb.confignode.consensus.request.read.partition;
 
+import org.apache.iotdb.common.rpc.thrift.TConsensusGroupId;
+import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType;
 import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
 import org.apache.iotdb.commons.utils.ThriftCommonsSerDeUtils;
 import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
@@ -30,31 +32,49 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.Objects;
 
-public class GetTimeSlotListPlan extends ConfigPhysicalPlan {
+public class CountTimeSlotListPlan extends ConfigPhysicalPlan {
 
-  private String storageGroup;
+  private String database;
 
   private TSeriesPartitionSlot seriesSlotId;
 
+  private TConsensusGroupId regionId;
+
   private long startTime;
 
   private long endTime;
 
-  public GetTimeSlotListPlan() {
-    super(ConfigPhysicalPlanType.GetTimeSlotList);
+  public CountTimeSlotListPlan() {
+    super(ConfigPhysicalPlanType.CountTimeSlotList);
   }
 
-  public GetTimeSlotListPlan(
-      String storageGroup, TSeriesPartitionSlot seriesSlotId, long startTime, long endTime) {
+  public CountTimeSlotListPlan(long startTime, long endTime) {
     this();
-    this.storageGroup = storageGroup;
-    this.seriesSlotId = seriesSlotId;
     this.startTime = startTime;
     this.endTime = endTime;
+    this.database = "";
+    this.seriesSlotId = new TSeriesPartitionSlot(-1);
+    this.regionId = new TConsensusGroupId(TConsensusGroupType.DataRegion, -1);
+  }
+
+  public void setDatabase(String database) {
+    this.database = database;
   }
 
   public String getDatabase() {
-    return storageGroup;
+    return database;
+  }
+
+  public void setRegionId(TConsensusGroupId regionId) {
+    this.regionId = regionId;
+  }
+
+  public TConsensusGroupId getRegionId() {
+    return regionId;
+  }
+
+  public void setSeriesSlotId(TSeriesPartitionSlot seriesSlotId) {
+    this.seriesSlotId = seriesSlotId;
   }
 
   public TSeriesPartitionSlot getSeriesSlotId() {
@@ -72,16 +92,18 @@ public class GetTimeSlotListPlan extends ConfigPhysicalPlan {
   @Override
   protected void serializeImpl(DataOutputStream stream) throws IOException {
     stream.writeShort(getType().getPlanType());
-    ReadWriteIOUtils.write(storageGroup, stream);
+    ReadWriteIOUtils.write(database, stream);
     ThriftCommonsSerDeUtils.serializeTSeriesPartitionSlot(seriesSlotId, stream);
+    ThriftCommonsSerDeUtils.serializeTConsensusGroupId(regionId, stream);
     stream.writeLong(startTime);
     stream.writeLong(endTime);
   }
 
   @Override
   protected void deserializeImpl(ByteBuffer buffer) throws IOException {
-    this.storageGroup = ReadWriteIOUtils.readString(buffer);
+    this.database = ReadWriteIOUtils.readString(buffer);
     this.seriesSlotId = ThriftCommonsSerDeUtils.deserializeTSeriesPartitionSlot(buffer);
+    this.regionId = ThriftCommonsSerDeUtils.deserializeTConsensusGroupId(buffer);
     this.startTime = buffer.getLong();
     this.endTime = buffer.getLong();
   }
@@ -90,9 +112,10 @@ public class GetTimeSlotListPlan extends ConfigPhysicalPlan {
   public boolean equals(Object o) {
     if (this == o) return true;
     if (o == null || getClass() != o.getClass()) return false;
-    GetTimeSlotListPlan that = (GetTimeSlotListPlan) o;
-    return storageGroup.equals(that.storageGroup)
+    CountTimeSlotListPlan that = (CountTimeSlotListPlan) o;
+    return database.equals(that.database)
         && seriesSlotId.equals(that.seriesSlotId)
+        && regionId.equals(that.regionId)
         && startTime == that.startTime
         && endTime == that.endTime;
   }
@@ -100,8 +123,9 @@ public class GetTimeSlotListPlan extends ConfigPhysicalPlan {
   @Override
   public int hashCode() {
     int hashcode = 1;
-    hashcode = hashcode * 31 + Objects.hash(storageGroup);
+    hashcode = hashcode * 31 + Objects.hash(database);
     hashcode = hashcode * 31 + seriesSlotId.hashCode();
+    hashcode = hashcode * 31 + regionId.hashCode();
     hashcode = hashcode * 31 + (int) startTime;
     hashcode = hashcode * 31 + (int) endTime;
     return hashcode;
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSeriesSlotListPlan.java b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSeriesSlotListPlan.java
index f916b5b357..aea32c20f8 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSeriesSlotListPlan.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSeriesSlotListPlan.java
@@ -31,7 +31,7 @@ import java.util.Objects;
 
 public class GetSeriesSlotListPlan extends ConfigPhysicalPlan {
 
-  private String storageGroup;
+  private String database;
 
   private TConsensusGroupType partitionType;
 
@@ -39,14 +39,14 @@ public class GetSeriesSlotListPlan extends ConfigPhysicalPlan {
     super(ConfigPhysicalPlanType.GetSeriesSlotList);
   }
 
-  public GetSeriesSlotListPlan(String storageGroup, TConsensusGroupType partitionType) {
+  public GetSeriesSlotListPlan(String database, TConsensusGroupType partitionType) {
     this();
-    this.storageGroup = storageGroup;
+    this.database = database;
     this.partitionType = partitionType;
   }
 
   public String getDatabase() {
-    return storageGroup;
+    return database;
   }
 
   public TConsensusGroupType getPartitionType() {
@@ -56,13 +56,13 @@ public class GetSeriesSlotListPlan extends ConfigPhysicalPlan {
   @Override
   protected void serializeImpl(DataOutputStream stream) throws IOException {
     stream.writeShort(getType().getPlanType());
-    ReadWriteIOUtils.write(storageGroup, stream);
+    ReadWriteIOUtils.write(database, stream);
     stream.writeInt(partitionType.ordinal());
   }
 
   @Override
   protected void deserializeImpl(ByteBuffer buffer) throws IOException {
-    this.storageGroup = ReadWriteIOUtils.readString(buffer);
+    this.database = ReadWriteIOUtils.readString(buffer);
     this.partitionType = TConsensusGroupType.findByValue(buffer.getInt());
   }
 
@@ -71,14 +71,14 @@ public class GetSeriesSlotListPlan extends ConfigPhysicalPlan {
     if (this == o) return true;
     if (o == null || getClass() != o.getClass()) return false;
     GetSeriesSlotListPlan that = (GetSeriesSlotListPlan) o;
-    return storageGroup.equals(that.storageGroup) && partitionType.equals(that.partitionType);
+    return database.equals(that.database) && partitionType.equals(that.partitionType);
   }
 
   @Override
   public int hashCode() {
     int hashcode = 1;
-    hashcode = hashcode * 31 + Objects.hash(storageGroup);
-    hashcode = hashcode * 31 + partitionType.ordinal();
+    hashcode = hashcode * 31 + Objects.hash(database);
+    hashcode = hashcode * 31 + Objects.hash(partitionType.ordinal());
     return hashcode;
   }
 }
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetTimeSlotListPlan.java b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetTimeSlotListPlan.java
index dc36c50151..6a67afee64 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetTimeSlotListPlan.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetTimeSlotListPlan.java
@@ -19,6 +19,8 @@
 
 package org.apache.iotdb.confignode.consensus.request.read.partition;
 
+import org.apache.iotdb.common.rpc.thrift.TConsensusGroupId;
+import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType;
 import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
 import org.apache.iotdb.commons.utils.ThriftCommonsSerDeUtils;
 import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
@@ -32,10 +34,12 @@ import java.util.Objects;
 
 public class GetTimeSlotListPlan extends ConfigPhysicalPlan {
 
-  private String storageGroup;
+  private String database;
 
   private TSeriesPartitionSlot seriesSlotId;
 
+  private TConsensusGroupId regionId;
+
   private long startTime;
 
   private long endTime;
@@ -44,17 +48,33 @@ public class GetTimeSlotListPlan extends ConfigPhysicalPlan {
     super(ConfigPhysicalPlanType.GetTimeSlotList);
   }
 
-  public GetTimeSlotListPlan(
-      String storageGroup, TSeriesPartitionSlot seriesSlotId, long startTime, long endTime) {
+  public GetTimeSlotListPlan(long startTime, long endTime) {
     this();
-    this.storageGroup = storageGroup;
-    this.seriesSlotId = seriesSlotId;
     this.startTime = startTime;
     this.endTime = endTime;
+    this.database = "";
+    this.seriesSlotId = new TSeriesPartitionSlot(-1);
+    this.regionId = new TConsensusGroupId(TConsensusGroupType.DataRegion, -1);
+  }
+
+  public void setDatabase(String database) {
+    this.database = database;
   }
 
   public String getDatabase() {
-    return storageGroup;
+    return database;
+  }
+
+  public void setRegionId(TConsensusGroupId regionId) {
+    this.regionId = regionId;
+  }
+
+  public TConsensusGroupId getRegionId() {
+    return regionId;
+  }
+
+  public void setSeriesSlotId(TSeriesPartitionSlot seriesSlotId) {
+    this.seriesSlotId = seriesSlotId;
   }
 
   public TSeriesPartitionSlot getSeriesSlotId() {
@@ -72,16 +92,18 @@ public class GetTimeSlotListPlan extends ConfigPhysicalPlan {
   @Override
   protected void serializeImpl(DataOutputStream stream) throws IOException {
     stream.writeShort(getType().getPlanType());
-    ReadWriteIOUtils.write(storageGroup, stream);
+    ReadWriteIOUtils.write(database, stream);
     ThriftCommonsSerDeUtils.serializeTSeriesPartitionSlot(seriesSlotId, stream);
+    ThriftCommonsSerDeUtils.serializeTConsensusGroupId(regionId, stream);
     stream.writeLong(startTime);
     stream.writeLong(endTime);
   }
 
   @Override
   protected void deserializeImpl(ByteBuffer buffer) throws IOException {
-    this.storageGroup = ReadWriteIOUtils.readString(buffer);
+    this.database = ReadWriteIOUtils.readString(buffer);
     this.seriesSlotId = ThriftCommonsSerDeUtils.deserializeTSeriesPartitionSlot(buffer);
+    this.regionId = ThriftCommonsSerDeUtils.deserializeTConsensusGroupId(buffer);
     this.startTime = buffer.getLong();
     this.endTime = buffer.getLong();
   }
@@ -91,8 +113,9 @@ public class GetTimeSlotListPlan extends ConfigPhysicalPlan {
     if (this == o) return true;
     if (o == null || getClass() != o.getClass()) return false;
     GetTimeSlotListPlan that = (GetTimeSlotListPlan) o;
-    return storageGroup.equals(that.storageGroup)
+    return database.equals(that.database)
         && seriesSlotId.equals(that.seriesSlotId)
+        && regionId.equals(that.regionId)
         && startTime == that.startTime
         && endTime == that.endTime;
   }
@@ -100,8 +123,9 @@ public class GetTimeSlotListPlan extends ConfigPhysicalPlan {
   @Override
   public int hashCode() {
     int hashcode = 1;
-    hashcode = hashcode * 31 + Objects.hash(storageGroup);
+    hashcode = hashcode * 31 + Objects.hash(database);
     hashcode = hashcode * 31 + seriesSlotId.hashCode();
+    hashcode = hashcode * 31 + regionId.hashCode();
     hashcode = hashcode * 31 + (int) startTime;
     hashcode = hashcode * 31 + (int) endTime;
     return hashcode;
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/region/GetRegionIdPlan.java b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/region/GetRegionIdPlan.java
index 4fee4b98a1..273623d03f 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/region/GetRegionIdPlan.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/region/GetRegionIdPlan.java
@@ -34,59 +34,67 @@ import java.util.Objects;
 
 public class GetRegionIdPlan extends ConfigPhysicalPlan {
 
-  private String storageGroup;
+  private String database;
 
   private TConsensusGroupType partitionType;
 
-  private TSeriesPartitionSlot seriesSlotId;
-
   private TTimePartitionSlot timeSlotId;
 
+  private TSeriesPartitionSlot seriesSlotId;
+
   public GetRegionIdPlan() {
     super(ConfigPhysicalPlanType.GetRegionId);
   }
 
-  public GetRegionIdPlan(
-      String storageGroup,
-      TConsensusGroupType partitionType,
-      TSeriesPartitionSlot seriesSlotId,
-      TTimePartitionSlot timeSlotId) {
+  public GetRegionIdPlan(TConsensusGroupType partitionType) {
     this();
     this.partitionType = partitionType;
-    this.storageGroup = storageGroup;
-    this.timeSlotId = timeSlotId;
-    this.seriesSlotId = seriesSlotId;
+    this.database = "";
+    this.seriesSlotId = new TSeriesPartitionSlot(-1);
+    this.timeSlotId = new TTimePartitionSlot(-1);
   }
 
   public String getDatabase() {
-    return storageGroup;
+    return database;
   }
 
-  public TConsensusGroupType getPartitionType() {
-    return partitionType;
+  public void setDatabase(String database) {
+    this.database = database;
+  }
+
+  public void setSeriesSlotId(TSeriesPartitionSlot seriesSlotId) {
+    this.seriesSlotId = seriesSlotId;
   }
 
   public TSeriesPartitionSlot getSeriesSlotId() {
     return seriesSlotId;
   }
 
+  public void setTimeSlotId(TTimePartitionSlot timeSlotId) {
+    this.timeSlotId = timeSlotId;
+  }
+
   public TTimePartitionSlot getTimeSlotId() {
     return timeSlotId;
   }
 
+  public TConsensusGroupType getPartitionType() {
+    return partitionType;
+  }
+
   @Override
   protected void serializeImpl(DataOutputStream stream) throws IOException {
     stream.writeShort(getType().getPlanType());
-    ReadWriteIOUtils.write(storageGroup, stream);
     stream.writeInt(partitionType.ordinal());
+    ReadWriteIOUtils.write(database, stream);
     ThriftCommonsSerDeUtils.serializeTSeriesPartitionSlot(seriesSlotId, stream);
     ThriftCommonsSerDeUtils.serializeTTimePartitionSlot(timeSlotId, stream);
   }
 
   @Override
   protected void deserializeImpl(ByteBuffer buffer) throws IOException {
-    this.storageGroup = ReadWriteIOUtils.readString(buffer);
     this.partitionType = TConsensusGroupType.findByValue(buffer.getInt());
+    this.database = ReadWriteIOUtils.readString(buffer);
     this.seriesSlotId = ThriftCommonsSerDeUtils.deserializeTSeriesPartitionSlot(buffer);
     this.timeSlotId = ThriftCommonsSerDeUtils.deserializeTTimePartitionSlot(buffer);
   }
@@ -96,7 +104,8 @@ public class GetRegionIdPlan extends ConfigPhysicalPlan {
     if (this == o) return true;
     if (o == null || getClass() != o.getClass()) return false;
     GetRegionIdPlan that = (GetRegionIdPlan) o;
-    return storageGroup.equals(that.storageGroup)
+    return database.equals(that.database)
+        && partitionType.equals(that.partitionType)
         && seriesSlotId.equals(that.seriesSlotId)
         && timeSlotId.equals(that.timeSlotId);
   }
@@ -104,7 +113,8 @@ public class GetRegionIdPlan extends ConfigPhysicalPlan {
   @Override
   public int hashCode() {
     int hashcode = 1;
-    hashcode = hashcode * 31 + Objects.hash(storageGroup);
+    hashcode = hashcode * 31 + Objects.hash(partitionType.ordinal());
+    hashcode = hashcode * 31 + Objects.hash(database);
     hashcode = hashcode * 31 + seriesSlotId.hashCode();
     hashcode = hashcode * 31 + timeSlotId.hashCode();
     return hashcode;
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/partition/GetRegionIdResp.java b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/partition/CountTimeSlotListResp.java
similarity index 71%
copy from confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/partition/GetRegionIdResp.java
copy to confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/partition/CountTimeSlotListResp.java
index 617591225a..d4a76a8976 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/partition/GetRegionIdResp.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/partition/CountTimeSlotListResp.java
@@ -19,23 +19,20 @@
 
 package org.apache.iotdb.confignode.consensus.response.partition;
 
-import org.apache.iotdb.common.rpc.thrift.TConsensusGroupId;
 import org.apache.iotdb.common.rpc.thrift.TSStatus;
-import org.apache.iotdb.confignode.rpc.thrift.TGetRegionIdResp;
+import org.apache.iotdb.confignode.rpc.thrift.TCountTimeSlotListResp;
 import org.apache.iotdb.consensus.common.DataSet;
 import org.apache.iotdb.rpc.TSStatusCode;
 
-import java.util.List;
-
-public class GetRegionIdResp implements DataSet {
+public class CountTimeSlotListResp implements DataSet {
 
   private TSStatus status;
 
-  private final List<TConsensusGroupId> dataRegionIdList;
+  private final long count;
 
-  public GetRegionIdResp(TSStatus status, List<TConsensusGroupId> dataRegionIdList) {
+  public CountTimeSlotListResp(TSStatus status, long count) {
     this.status = status;
-    this.dataRegionIdList = dataRegionIdList;
+    this.count = count;
   }
 
   public TSStatus getStatus() {
@@ -46,12 +43,12 @@ public class GetRegionIdResp implements DataSet {
     this.status = status;
   }
 
-  public TGetRegionIdResp convertToRpcGetRegionIdResp() {
-    TGetRegionIdResp resp = new TGetRegionIdResp();
+  public TCountTimeSlotListResp convertToRpcCountTimeSlotListResp() {
+    TCountTimeSlotListResp resp = new TCountTimeSlotListResp();
     resp.setStatus(status);
 
     if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
-      resp.dataRegionIdList = dataRegionIdList;
+      resp.setCount(count);
     }
 
     return resp;
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/partition/GetRegionIdResp.java b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/partition/GetRegionIdResp.java
index 617591225a..0b7825cde7 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/partition/GetRegionIdResp.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/partition/GetRegionIdResp.java
@@ -51,7 +51,7 @@ public class GetRegionIdResp implements DataSet {
     resp.setStatus(status);
 
     if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
-      resp.dataRegionIdList = dataRegionIdList;
+      resp.setDataRegionIdList(dataRegionIdList);
     }
 
     return resp;
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/partition/GetSeriesSlotListResp.java b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/partition/GetSeriesSlotListResp.java
index 77aa4c990b..4f60b50942 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/partition/GetSeriesSlotListResp.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/partition/GetSeriesSlotListResp.java
@@ -51,7 +51,7 @@ public class GetSeriesSlotListResp implements DataSet {
     resp.setStatus(status);
 
     if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
-      resp.seriesSlotList = seriesSlotList;
+      resp.setSeriesSlotList(seriesSlotList);
     }
 
     return resp;
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/partition/GetTimeSlotListResp.java b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/partition/GetTimeSlotListResp.java
index e4ef4c7d14..5774f17924 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/partition/GetTimeSlotListResp.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/partition/GetTimeSlotListResp.java
@@ -51,7 +51,7 @@ public class GetTimeSlotListResp implements DataSet {
     resp.setStatus(status);
 
     if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
-      resp.timeSlotList = timeSlotList;
+      resp.setTimeSlotList(timeSlotList);
     }
 
     return resp;
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java b/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
index 7fd2fb85c5..96666e1eda 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
@@ -54,8 +54,6 @@ import org.apache.iotdb.confignode.consensus.request.read.partition.GetNodePaths
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetOrCreateDataPartitionPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetOrCreateSchemaPartitionPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetSchemaPartitionPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetSeriesSlotListPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetTimeSlotListPlan;
 import org.apache.iotdb.confignode.consensus.request.read.region.GetRegionInfoListPlan;
 import org.apache.iotdb.confignode.consensus.request.write.confignode.RemoveConfigNodePlan;
 import org.apache.iotdb.confignode.consensus.request.write.database.DatabaseSchemaPlan;
@@ -106,6 +104,8 @@ import org.apache.iotdb.confignode.rpc.thrift.TClusterParameters;
 import org.apache.iotdb.confignode.rpc.thrift.TConfigNodeRegisterReq;
 import org.apache.iotdb.confignode.rpc.thrift.TConfigNodeRegisterResp;
 import org.apache.iotdb.confignode.rpc.thrift.TConfigNodeRestartReq;
+import org.apache.iotdb.confignode.rpc.thrift.TCountTimeSlotListReq;
+import org.apache.iotdb.confignode.rpc.thrift.TCountTimeSlotListResp;
 import org.apache.iotdb.confignode.rpc.thrift.TCreateCQReq;
 import org.apache.iotdb.confignode.rpc.thrift.TCreateFunctionReq;
 import org.apache.iotdb.confignode.rpc.thrift.TCreateModelReq;
@@ -133,8 +133,10 @@ import org.apache.iotdb.confignode.rpc.thrift.TGetPathsSetTemplatesResp;
 import org.apache.iotdb.confignode.rpc.thrift.TGetPipePluginTableResp;
 import org.apache.iotdb.confignode.rpc.thrift.TGetRegionIdReq;
 import org.apache.iotdb.confignode.rpc.thrift.TGetRegionIdResp;
+import org.apache.iotdb.confignode.rpc.thrift.TGetSeriesSlotListReq;
 import org.apache.iotdb.confignode.rpc.thrift.TGetSeriesSlotListResp;
 import org.apache.iotdb.confignode.rpc.thrift.TGetTemplateResp;
+import org.apache.iotdb.confignode.rpc.thrift.TGetTimeSlotListReq;
 import org.apache.iotdb.confignode.rpc.thrift.TGetTimeSlotListResp;
 import org.apache.iotdb.confignode.rpc.thrift.TGetTriggerTableResp;
 import org.apache.iotdb.confignode.rpc.thrift.TGetUDFTableResp;
@@ -1641,18 +1643,26 @@ public class ConfigManager implements IManager {
   }
 
   @Override
-  public TGetTimeSlotListResp getTimeSlotList(GetTimeSlotListPlan plan) {
+  public TGetTimeSlotListResp getTimeSlotList(TGetTimeSlotListReq req) {
     TSStatus status = confirmLeader();
     return status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()
-        ? partitionManager.getTimeSlotList(plan).convertToRpcGetTimeSlotListResp()
+        ? partitionManager.getTimeSlotList(req).convertToRpcGetTimeSlotListResp()
         : new TGetTimeSlotListResp(status);
   }
 
   @Override
-  public TGetSeriesSlotListResp getSeriesSlotList(GetSeriesSlotListPlan plan) {
+  public TCountTimeSlotListResp countTimeSlotList(TCountTimeSlotListReq req) {
     TSStatus status = confirmLeader();
     return status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()
-        ? partitionManager.getSeriesSlotList(plan).convertToRpcGetSeriesSlotListResp()
+        ? partitionManager.countTimeSlotList(req).convertToRpcCountTimeSlotListResp()
+        : new TCountTimeSlotListResp(status);
+  }
+
+  @Override
+  public TGetSeriesSlotListResp getSeriesSlotList(TGetSeriesSlotListReq req) {
+    TSStatus status = confirmLeader();
+    return status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()
+        ? partitionManager.getSeriesSlotList(req).convertToRpcGetSeriesSlotListResp()
         : new TGetSeriesSlotListResp(status);
   }
 
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java b/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java
index a861635f5b..0cc60c8f9f 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java
@@ -31,8 +31,6 @@ import org.apache.iotdb.confignode.consensus.request.read.database.GetDatabasePl
 import org.apache.iotdb.confignode.consensus.request.read.datanode.GetDataNodeConfigurationPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetDataPartitionPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetOrCreateDataPartitionPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetSeriesSlotListPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetTimeSlotListPlan;
 import org.apache.iotdb.confignode.consensus.request.read.region.GetRegionInfoListPlan;
 import org.apache.iotdb.confignode.consensus.request.write.confignode.RemoveConfigNodePlan;
 import org.apache.iotdb.confignode.consensus.request.write.database.DatabaseSchemaPlan;
@@ -51,6 +49,8 @@ import org.apache.iotdb.confignode.rpc.thrift.TAlterSchemaTemplateReq;
 import org.apache.iotdb.confignode.rpc.thrift.TConfigNodeRegisterReq;
 import org.apache.iotdb.confignode.rpc.thrift.TConfigNodeRegisterResp;
 import org.apache.iotdb.confignode.rpc.thrift.TConfigNodeRestartReq;
+import org.apache.iotdb.confignode.rpc.thrift.TCountTimeSlotListReq;
+import org.apache.iotdb.confignode.rpc.thrift.TCountTimeSlotListResp;
 import org.apache.iotdb.confignode.rpc.thrift.TCreateCQReq;
 import org.apache.iotdb.confignode.rpc.thrift.TCreateFunctionReq;
 import org.apache.iotdb.confignode.rpc.thrift.TCreateModelReq;
@@ -77,8 +77,10 @@ import org.apache.iotdb.confignode.rpc.thrift.TGetPathsSetTemplatesResp;
 import org.apache.iotdb.confignode.rpc.thrift.TGetPipePluginTableResp;
 import org.apache.iotdb.confignode.rpc.thrift.TGetRegionIdReq;
 import org.apache.iotdb.confignode.rpc.thrift.TGetRegionIdResp;
+import org.apache.iotdb.confignode.rpc.thrift.TGetSeriesSlotListReq;
 import org.apache.iotdb.confignode.rpc.thrift.TGetSeriesSlotListResp;
 import org.apache.iotdb.confignode.rpc.thrift.TGetTemplateResp;
+import org.apache.iotdb.confignode.rpc.thrift.TGetTimeSlotListReq;
 import org.apache.iotdb.confignode.rpc.thrift.TGetTimeSlotListResp;
 import org.apache.iotdb.confignode.rpc.thrift.TGetTriggerTableResp;
 import org.apache.iotdb.confignode.rpc.thrift.TGetUDFTableResp;
@@ -602,11 +604,36 @@ public interface IManager {
    */
   TSStatus recordPipeMessage(TRecordPipeMessageReq req);
 
+  /**
+   * Get RegionId。used for Show cluster slots information in
+   * docs/zh/UserGuide/Cluster/Cluster-Maintenance.md.
+   *
+   * @return TGetRegionIdResp.
+   */
   TGetRegionIdResp getRegionId(TGetRegionIdReq req);
 
-  TGetTimeSlotListResp getTimeSlotList(GetTimeSlotListPlan plan);
+  /**
+   * Get timeSlot(timePartition)。used for Show cluster slots information in
+   * docs/zh/UserGuide/Cluster/Cluster-Maintenance.md.
+   *
+   * @return TGetTimeSlotListResp.
+   */
+  TGetTimeSlotListResp getTimeSlotList(TGetTimeSlotListReq req);
+  /**
+   * Count timeSlot(timePartition)。used for Show cluster slots information in
+   * docs/zh/UserGuide/Cluster/Cluster-Maintenance.md.
+   *
+   * @return TCountTimeSlotListResp.
+   */
+  TCountTimeSlotListResp countTimeSlotList(TCountTimeSlotListReq req);
 
-  TGetSeriesSlotListResp getSeriesSlotList(GetSeriesSlotListPlan plan);
+  /**
+   * Get seriesSlot。used for Show cluster slots information in
+   * docs/zh/UserGuide/Cluster/Cluster-Maintenance.md.
+   *
+   * @return TGetSeriesSlotListResp.
+   */
+  TGetSeriesSlotListResp getSeriesSlotList(TGetSeriesSlotListReq req);
 
   TSStatus migrateRegion(TMigrateRegionReq req);
 
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/manager/consensus/ConsensusManager.java b/confignode/src/main/java/org/apache/iotdb/confignode/manager/consensus/ConsensusManager.java
index 16302fac47..d7e7c59500 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/manager/consensus/ConsensusManager.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/manager/consensus/ConsensusManager.java
@@ -64,7 +64,7 @@ public class ConsensusManager {
   private static final int SEED_CONFIG_NODE_ID = 0;
   /** There is only one ConfigNodeGroup */
   public static final ConsensusGroupId DEFAULT_CONSENSUS_GROUP_ID =
-      new ConfigRegionId(CONF.getConfigRegionId());;
+      new ConfigRegionId(CONF.getConfigRegionId());
 
   private final IManager configManager;
   private IConsensus consensusImpl;
@@ -223,12 +223,10 @@ public class ConsensusManager {
     File consensusDir = new File(CONF.getConsensusDir());
     if (consensusDir.exists()) {
       File oldWalDir = new File(consensusDir, "simple");
-      if (oldWalDir.exists()) {
-        if (!oldWalDir.renameTo(new File(getConfigRegionDir()))) {
-          LOGGER.warn(
-              "upgrade ConfigNode consensus wal dir for SimpleConsensus from version/1.0 to version/1.1 failed, "
-                  + "you maybe need to rename the simple dir to 0_0 manually.");
-        }
+      if (oldWalDir.exists() && !oldWalDir.renameTo(new File(getConfigRegionDir()))) {
+        LOGGER.warn(
+            "upgrade ConfigNode consensus wal dir for SimpleConsensus from version/1.0 to version/1.1 failed, "
+                + "you maybe need to rename the simple dir to 0_0 manually.");
       }
     }
   }
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java b/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
index f15978d6bd..60dcb30007 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
@@ -37,6 +37,7 @@ import org.apache.iotdb.confignode.client.async.AsyncDataNodeClientPool;
 import org.apache.iotdb.confignode.client.async.handlers.AsyncClientHandler;
 import org.apache.iotdb.confignode.conf.ConfigNodeConfig;
 import org.apache.iotdb.confignode.conf.ConfigNodeDescriptor;
+import org.apache.iotdb.confignode.consensus.request.read.partition.CountTimeSlotListPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetDataPartitionPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetNodePathsPartitionPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetOrCreateDataPartitionPlan;
@@ -52,6 +53,7 @@ import org.apache.iotdb.confignode.consensus.request.write.partition.CreateSchem
 import org.apache.iotdb.confignode.consensus.request.write.partition.UpdateRegionLocationPlan;
 import org.apache.iotdb.confignode.consensus.request.write.region.CreateRegionGroupsPlan;
 import org.apache.iotdb.confignode.consensus.request.write.region.PollSpecificRegionMaintainTaskPlan;
+import org.apache.iotdb.confignode.consensus.response.partition.CountTimeSlotListResp;
 import org.apache.iotdb.confignode.consensus.response.partition.DataPartitionResp;
 import org.apache.iotdb.confignode.consensus.response.partition.GetRegionIdResp;
 import org.apache.iotdb.confignode.consensus.response.partition.GetSeriesSlotListResp;
@@ -72,7 +74,10 @@ import org.apache.iotdb.confignode.persistence.partition.maintainer.RegionCreate
 import org.apache.iotdb.confignode.persistence.partition.maintainer.RegionDeleteTask;
 import org.apache.iotdb.confignode.persistence.partition.maintainer.RegionMaintainTask;
 import org.apache.iotdb.confignode.persistence.partition.maintainer.RegionMaintainType;
+import org.apache.iotdb.confignode.rpc.thrift.TCountTimeSlotListReq;
 import org.apache.iotdb.confignode.rpc.thrift.TGetRegionIdReq;
+import org.apache.iotdb.confignode.rpc.thrift.TGetSeriesSlotListReq;
+import org.apache.iotdb.confignode.rpc.thrift.TGetTimeSlotListReq;
 import org.apache.iotdb.confignode.rpc.thrift.TTimeSlotList;
 import org.apache.iotdb.consensus.common.DataSet;
 import org.apache.iotdb.consensus.common.response.ConsensusReadResponse;
@@ -817,27 +822,52 @@ public class PartitionManager {
   }
 
   public GetRegionIdResp getRegionId(TGetRegionIdReq req) {
-    GetRegionIdPlan plan =
-        new GetRegionIdPlan(
-            req.getDatabase(),
-            req.getType(),
-            req.isSetSeriesSlotId()
-                ? req.getSeriesSlotId()
-                : executor.getSeriesPartitionSlot(req.getDeviceId()),
-            req.isSetTimeSlotId()
-                ? req.getTimeSlotId()
-                : (req.isSetTimeStamp()
-                    ? new TTimePartitionSlot(
-                        req.getTimeStamp() - req.getTimeStamp() % CONF.getTimePartitionInterval())
-                    : null));
+    GetRegionIdPlan plan = new GetRegionIdPlan(req.getType());
+    if (req.isSetDatabase()) {
+      plan.setDatabase(req.getDatabase());
+    } else {
+      plan.setSeriesSlotId(executor.getSeriesPartitionSlot(req.getDevice()));
+    }
+    if (req.isSetTimeStamp()) {
+      plan.setTimeSlotId(
+          new TTimePartitionSlot(
+              req.getTimeStamp() - req.getTimeStamp() % CONF.getTimePartitionInterval()));
+    }
     return (GetRegionIdResp) getConsensusManager().read(plan).getDataset();
   }
 
-  public GetTimeSlotListResp getTimeSlotList(GetTimeSlotListPlan plan) {
+  public GetTimeSlotListResp getTimeSlotList(TGetTimeSlotListReq req) {
+    long startTime = req.isSetStartTime() ? req.getStartTime() : Long.MIN_VALUE;
+    long endTime = req.isSetEndTime() ? req.getEndTime() : Long.MAX_VALUE;
+    GetTimeSlotListPlan plan = new GetTimeSlotListPlan(startTime, endTime);
+    if (req.isSetDatabase()) {
+      plan.setDatabase(req.getDatabase());
+    } else if (req.isSetDevice()) {
+      plan.setSeriesSlotId(executor.getSeriesPartitionSlot(req.getDevice()));
+    } else {
+      plan.setRegionId(
+          new TConsensusGroupId(TConsensusGroupType.DataRegion, (int) req.getRegionId()));
+    }
     return (GetTimeSlotListResp) getConsensusManager().read(plan).getDataset();
   }
 
-  public GetSeriesSlotListResp getSeriesSlotList(GetSeriesSlotListPlan plan) {
+  public CountTimeSlotListResp countTimeSlotList(TCountTimeSlotListReq req) {
+    long startTime = req.isSetStartTime() ? req.getStartTime() : Long.MIN_VALUE;
+    long endTime = req.isSetEndTime() ? req.getEndTime() : Long.MAX_VALUE;
+    CountTimeSlotListPlan plan = new CountTimeSlotListPlan(startTime, endTime);
+    if (req.isSetDatabase()) {
+      plan.setDatabase(req.getDatabase());
+    } else if (req.isSetDevice()) {
+      plan.setSeriesSlotId(executor.getSeriesPartitionSlot(req.getDevice()));
+    } else {
+      plan.setRegionId(
+          new TConsensusGroupId(TConsensusGroupType.DataRegion, (int) req.getRegionId()));
+    }
+    return (CountTimeSlotListResp) getConsensusManager().read(plan).getDataset();
+  }
+
+  public GetSeriesSlotListResp getSeriesSlotList(TGetSeriesSlotListReq req) {
+    GetSeriesSlotListPlan plan = new GetSeriesSlotListPlan(req.getDatabase(), req.getType());
     return (GetSeriesSlotListResp) getConsensusManager().read(plan).getDataset();
   }
 
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/executor/ConfigPlanExecutor.java b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/executor/ConfigPlanExecutor.java
index 7c6fa50350..2d54aef73b 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/executor/ConfigPlanExecutor.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/executor/ConfigPlanExecutor.java
@@ -31,6 +31,7 @@ import org.apache.iotdb.confignode.consensus.request.read.database.GetDatabasePl
 import org.apache.iotdb.confignode.consensus.request.read.datanode.GetDataNodeConfigurationPlan;
 import org.apache.iotdb.confignode.consensus.request.read.model.ShowModelPlan;
 import org.apache.iotdb.confignode.consensus.request.read.model.ShowTrailPlan;
+import org.apache.iotdb.confignode.consensus.request.read.partition.CountTimeSlotListPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetDataPartitionPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetNodePathsPartitionPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetSchemaPartitionPlan;
@@ -262,6 +263,8 @@ public class ConfigPlanExecutor {
         return partitionInfo.getRegionId((GetRegionIdPlan) req);
       case GetTimeSlotList:
         return partitionInfo.getTimeSlotList((GetTimeSlotListPlan) req);
+      case CountTimeSlotList:
+        return partitionInfo.countTimeSlotList((CountTimeSlotListPlan) req);
       case GetSeriesSlotList:
         return partitionInfo.getSeriesSlotList((GetSeriesSlotListPlan) req);
       case SHOW_CQ:
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/DatabasePartitionTable.java b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/DatabasePartitionTable.java
index 736083f7b0..d0a5638d74 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/DatabasePartitionTable.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/DatabasePartitionTable.java
@@ -43,7 +43,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.ArrayList;
-import java.util.Comparator;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -54,7 +53,6 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 public class DatabasePartitionTable {
   private static final Logger LOGGER = LoggerFactory.getLogger(DatabasePartitionTable.class);
@@ -447,24 +445,15 @@ public class DatabasePartitionTable {
   }
 
   public List<TTimePartitionSlot> getTimeSlotList(
-      TSeriesPartitionSlot seriesSlotId, long startTime, long endTime) {
-    return dataPartitionTable.getTimeSlotList(seriesSlotId, startTime, endTime);
+      TSeriesPartitionSlot seriesSlotId, TConsensusGroupId regionId, long startTime, long endTime) {
+    return dataPartitionTable.getTimeSlotList(seriesSlotId, regionId, startTime, endTime);
   }
 
   public List<TSeriesPartitionSlot> getSeriesSlotList(TConsensusGroupType type) {
-    switch (type) {
-      case DataRegion:
-        return dataPartitionTable.getSeriesSlotList();
-      case SchemaRegion:
-        return schemaPartitionTable.getSeriesSlotList();
-      case ConfigRegion:
-      default:
-        return Stream.concat(
-                schemaPartitionTable.getSeriesSlotList().stream(),
-                dataPartitionTable.getSeriesSlotList().stream())
-            .distinct()
-            .sorted(Comparator.comparing(TSeriesPartitionSlot::getSlotId))
-            .collect(Collectors.toList());
+    if (type == TConsensusGroupType.DataRegion) {
+      return dataPartitionTable.getSeriesSlotList();
+    } else {
+      return schemaPartitionTable.getSeriesSlotList();
     }
   }
   /**
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java
index 799773a342..8dc940670a 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java
@@ -29,6 +29,7 @@ import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
 import org.apache.iotdb.commons.partition.DataPartitionTable;
 import org.apache.iotdb.commons.partition.SchemaPartitionTable;
 import org.apache.iotdb.commons.snapshot.SnapshotProcessor;
+import org.apache.iotdb.confignode.consensus.request.read.partition.CountTimeSlotListPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetDataPartitionPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetSchemaPartitionPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetSeriesSlotListPlan;
@@ -44,6 +45,7 @@ import org.apache.iotdb.confignode.consensus.request.write.partition.UpdateRegio
 import org.apache.iotdb.confignode.consensus.request.write.region.CreateRegionGroupsPlan;
 import org.apache.iotdb.confignode.consensus.request.write.region.OfferRegionMaintainTasksPlan;
 import org.apache.iotdb.confignode.consensus.request.write.region.PollSpecificRegionMaintainTaskPlan;
+import org.apache.iotdb.confignode.consensus.response.partition.CountTimeSlotListResp;
 import org.apache.iotdb.confignode.consensus.response.partition.DataPartitionResp;
 import org.apache.iotdb.confignode.consensus.response.partition.GetRegionIdResp;
 import org.apache.iotdb.confignode.consensus.response.partition.GetSeriesSlotListResp;
@@ -75,6 +77,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -86,6 +89,7 @@ import java.util.Vector;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
 
 /**
  * The PartitionInfo stores cluster PartitionTable. The PartitionTable including: 1. regionMap:
@@ -832,28 +836,124 @@ public class PartitionInfo implements SnapshotProcessor {
     }
   }
 
+  /**
+   * Get the RegionId of the specific Database or seriesSlotId(device).
+   *
+   * @param plan GetRegionIdPlan with the specific Database ,seriesSlotId(device) , timeSlotId.
+   * @return GetRegionIdResp with STATUS and List<TConsensusGroupId>.
+   */
   public DataSet getRegionId(GetRegionIdPlan plan) {
-    if (!isDatabaseExisted(plan.getDatabase())) {
+    if (!plan.getDatabase().equals("")) {
+      // get regionId of specific database.
+      if (!isDatabaseExisted(plan.getDatabase())) {
+        return new GetRegionIdResp(
+            new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()), new ArrayList<>());
+      } else {
+        DatabasePartitionTable sgPartitionTable = databasePartitionTables.get(plan.getDatabase());
+        return new GetRegionIdResp(
+            new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()),
+            sgPartitionTable
+                .getRegionId(plan.getPartitionType(), plan.getSeriesSlotId(), plan.getTimeSlotId())
+                .stream()
+                .distinct()
+                .sorted(Comparator.comparing(TConsensusGroupId::getId))
+                .collect(Collectors.toList()));
+      }
+    } else {
+      // get regionId of specific seriesSlotId(device).
+      List<TConsensusGroupId> regionIds = new ArrayList<>();
+      databasePartitionTables.forEach(
+          (database, databasePartitionTable) ->
+              regionIds.addAll(
+                  databasePartitionTable.getRegionId(
+                      plan.getPartitionType(), plan.getSeriesSlotId(), plan.getTimeSlotId())));
       return new GetRegionIdResp(
-          new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()), new ArrayList<>());
+          new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()),
+          regionIds.stream()
+              .distinct()
+              .sorted(Comparator.comparing(TConsensusGroupId::getId))
+              .collect(Collectors.toList()));
     }
-    DatabasePartitionTable sgPartitionTable = databasePartitionTables.get(plan.getDatabase());
-    return new GetRegionIdResp(
-        new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()),
-        sgPartitionTable.getRegionId(
-            plan.getPartitionType(), plan.getSeriesSlotId(), plan.getTimeSlotId()));
   }
 
+  /**
+   * Get the timePartition of the specific Database or seriesSlotId(device) or regionId.
+   *
+   * @param plan GetRegionIdPlan with the specific Database ,seriesSlotId(device) , regionId.
+   * @return GetRegionIdResp with STATUS and List<TTimePartitionSlot>.
+   */
   public DataSet getTimeSlotList(GetTimeSlotListPlan plan) {
-    if (!isDatabaseExisted(plan.getDatabase())) {
+    if (!plan.getDatabase().equals("")) {
+      if (!isDatabaseExisted(plan.getDatabase())) {
+        return new GetTimeSlotListResp(
+            new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()), new ArrayList<>());
+      } else {
+        DatabasePartitionTable sgPartitionTable = databasePartitionTables.get(plan.getDatabase());
+        return new GetTimeSlotListResp(
+            new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()),
+            sgPartitionTable
+                .getTimeSlotList(
+                    plan.getSeriesSlotId(),
+                    plan.getRegionId(),
+                    plan.getStartTime(),
+                    plan.getEndTime())
+                .stream()
+                .distinct()
+                .sorted(Comparator.comparing(TTimePartitionSlot::getStartTime))
+                .collect(Collectors.toList()));
+      }
+    } else {
+      List<TTimePartitionSlot> timePartitionSlots = new ArrayList<>();
+      databasePartitionTables.forEach(
+          (database, databasePartitionTable) ->
+              timePartitionSlots.addAll(
+                  databasePartitionTable.getTimeSlotList(
+                      plan.getSeriesSlotId(),
+                      plan.getRegionId(),
+                      plan.getStartTime(),
+                      plan.getEndTime())));
       return new GetTimeSlotListResp(
-          new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()), new ArrayList<>());
+          new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()),
+          timePartitionSlots.stream()
+              .distinct()
+              .sorted(Comparator.comparing(TTimePartitionSlot::getStartTime))
+              .collect(Collectors.toList()));
+    }
+  }
+
+  public DataSet countTimeSlotList(CountTimeSlotListPlan plan) {
+    if (!plan.getDatabase().equals("")) {
+      if (!isDatabaseExisted(plan.getDatabase())) {
+        return new CountTimeSlotListResp(
+            new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()), 0);
+      } else {
+        DatabasePartitionTable sgPartitionTable = databasePartitionTables.get(plan.getDatabase());
+        return new CountTimeSlotListResp(
+            new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()),
+            sgPartitionTable
+                .getTimeSlotList(
+                    plan.getSeriesSlotId(),
+                    plan.getRegionId(),
+                    plan.getStartTime(),
+                    plan.getEndTime())
+                .stream()
+                .distinct()
+                .count());
+      }
+    } else {
+      List<TTimePartitionSlot> timePartitionSlots = new ArrayList<>();
+      databasePartitionTables.forEach(
+          (database, databasePartitionTable) ->
+              timePartitionSlots.addAll(
+                  databasePartitionTable.getTimeSlotList(
+                      plan.getSeriesSlotId(),
+                      plan.getRegionId(),
+                      plan.getStartTime(),
+                      plan.getEndTime())));
+      return new CountTimeSlotListResp(
+          new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()),
+          timePartitionSlots.stream().distinct().count());
     }
-    DatabasePartitionTable sgPartitionTable = databasePartitionTables.get(plan.getDatabase());
-    return new GetTimeSlotListResp(
-        new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()),
-        sgPartitionTable.getTimeSlotList(
-            plan.getSeriesSlotId(), plan.getStartTime(), plan.getEndTime()));
   }
 
   public DataSet getSeriesSlotList(GetSeriesSlotListPlan plan) {
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java b/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java
index 04ddd4a019..88f4dd07d8 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java
@@ -45,8 +45,6 @@ import org.apache.iotdb.confignode.consensus.request.read.database.GetDatabasePl
 import org.apache.iotdb.confignode.consensus.request.read.datanode.GetDataNodeConfigurationPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetDataPartitionPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetOrCreateDataPartitionPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetSeriesSlotListPlan;
-import org.apache.iotdb.confignode.consensus.request.read.partition.GetTimeSlotListPlan;
 import org.apache.iotdb.confignode.consensus.request.read.region.GetRegionInfoListPlan;
 import org.apache.iotdb.confignode.consensus.request.write.confignode.RemoveConfigNodePlan;
 import org.apache.iotdb.confignode.consensus.request.write.database.DatabaseSchemaPlan;
@@ -75,6 +73,8 @@ import org.apache.iotdb.confignode.rpc.thrift.TConfigNodeRegisterReq;
 import org.apache.iotdb.confignode.rpc.thrift.TConfigNodeRegisterResp;
 import org.apache.iotdb.confignode.rpc.thrift.TConfigNodeRestartReq;
 import org.apache.iotdb.confignode.rpc.thrift.TCountDatabaseResp;
+import org.apache.iotdb.confignode.rpc.thrift.TCountTimeSlotListReq;
+import org.apache.iotdb.confignode.rpc.thrift.TCountTimeSlotListResp;
 import org.apache.iotdb.confignode.rpc.thrift.TCreateCQReq;
 import org.apache.iotdb.confignode.rpc.thrift.TCreateFunctionReq;
 import org.apache.iotdb.confignode.rpc.thrift.TCreateModelReq;
@@ -713,7 +713,7 @@ public class ConfigNodeRPCServiceProcessor implements IConfigNodeRPCService.Ifac
   }
 
   @Override
-  public TGetJarInListResp getPipePluginJar(TGetJarInListReq req) throws TException {
+  public TGetJarInListResp getPipePluginJar(TGetJarInListReq req) {
     return configManager.getPipePluginJar(req);
   }
 
@@ -915,26 +915,27 @@ public class ConfigNodeRPCServiceProcessor implements IConfigNodeRPCService.Ifac
 
   @Override
   public TGetRegionIdResp getRegionId(TGetRegionIdReq req) {
-    if (req.isSetTimeSlotId() && req.getType() != TConsensusGroupType.DataRegion) {
-      return new TGetRegionIdResp(new TSStatus(TSStatusCode.ILLEGAL_PARAMETER.getStatusCode()));
+    if (req.isSetTimeStamp() && req.getType() != TConsensusGroupType.DataRegion) {
+      TSStatus status = new TSStatus(TSStatusCode.ILLEGAL_PARAMETER.getStatusCode());
+      status.setMessage("Only data region can set time");
+      return new TGetRegionIdResp(status);
     }
     return configManager.getRegionId(req);
   }
 
   @Override
   public TGetTimeSlotListResp getTimeSlotList(TGetTimeSlotListReq req) {
-    long startTime = req.isSetStartTime() ? req.getStartTime() : Long.MIN_VALUE;
-    long endTime = req.isSetEndTime() ? req.getEndTime() : Long.MAX_VALUE;
-    GetTimeSlotListPlan plan =
-        new GetTimeSlotListPlan(req.getDatabase(), req.getSeriesSlotId(), startTime, endTime);
-    return configManager.getTimeSlotList(plan);
+    return configManager.getTimeSlotList(req);
+  }
+
+  @Override
+  public TCountTimeSlotListResp countTimeSlotList(TCountTimeSlotListReq req) {
+    return configManager.countTimeSlotList(req);
   }
 
   @Override
   public TGetSeriesSlotListResp getSeriesSlotList(TGetSeriesSlotListReq req) {
-    TConsensusGroupType type = req.isSetType() ? req.getType() : TConsensusGroupType.ConfigRegion;
-    GetSeriesSlotListPlan plan = new GetSeriesSlotListPlan(req.getDatabase(), type);
-    return configManager.getSeriesSlotList(plan);
+    return configManager.getSeriesSlotList(req);
   }
 
   @Override
@@ -958,32 +959,32 @@ public class ConfigNodeRPCServiceProcessor implements IConfigNodeRPCService.Ifac
   }
 
   @Override
-  public TSStatus createModel(TCreateModelReq req) throws TException {
+  public TSStatus createModel(TCreateModelReq req) {
     return configManager.createModel(req);
   }
 
   @Override
-  public TSStatus dropModel(TDropModelReq req) throws TException {
+  public TSStatus dropModel(TDropModelReq req) {
     return configManager.dropModel(req);
   }
 
   @Override
-  public TShowModelResp showModel(TShowModelReq req) throws TException {
+  public TShowModelResp showModel(TShowModelReq req) {
     return configManager.showModel(req);
   }
 
   @Override
-  public TShowTrailResp showTrail(TShowTrailReq req) throws TException {
+  public TShowTrailResp showTrail(TShowTrailReq req) {
     return configManager.showTrail(req);
   }
 
   @Override
-  public TSStatus updateModelInfo(TUpdateModelInfoReq req) throws TException {
+  public TSStatus updateModelInfo(TUpdateModelInfoReq req) {
     return configManager.updateModelInfo(req);
   }
 
   @Override
-  public TSStatus updateModelState(TUpdateModelStateReq req) throws TException {
+  public TSStatus updateModelState(TUpdateModelStateReq req) {
     return configManager.updateModelState(req);
   }
 
@@ -993,12 +994,12 @@ public class ConfigNodeRPCServiceProcessor implements IConfigNodeRPCService.Ifac
   }
 
   @Override
-  public TSpaceQuotaResp showSpaceQuota(List<String> databases) throws TException {
+  public TSpaceQuotaResp showSpaceQuota(List<String> databases) {
     return configManager.showSpaceQuota(databases);
   }
 
   @Override
-  public TSpaceQuotaResp getSpaceQuota() throws TException {
+  public TSpaceQuotaResp getSpaceQuota() {
     return configManager.getSpaceQuota();
   }
 
@@ -1008,12 +1009,12 @@ public class ConfigNodeRPCServiceProcessor implements IConfigNodeRPCService.Ifac
   }
 
   @Override
-  public TThrottleQuotaResp showThrottleQuota(TShowThrottleReq req) throws TException {
+  public TThrottleQuotaResp showThrottleQuota(TShowThrottleReq req) {
     return configManager.showThrottleQuota(req);
   }
 
   @Override
-  public TThrottleQuotaResp getThrottleQuota() throws TException {
+  public TThrottleQuotaResp getThrottleQuota() {
     return configManager.getThrottleQuota();
   }
 }
diff --git a/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java b/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java
index 55a2e622aa..f3a179f420 100644
--- a/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java
+++ b/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java
@@ -53,6 +53,7 @@ import org.apache.iotdb.confignode.consensus.request.read.database.CountDatabase
 import org.apache.iotdb.confignode.consensus.request.read.database.GetDatabasePlan;
 import org.apache.iotdb.confignode.consensus.request.read.datanode.GetDataNodeConfigurationPlan;
 import org.apache.iotdb.confignode.consensus.request.read.function.GetFunctionTablePlan;
+import org.apache.iotdb.confignode.consensus.request.read.partition.CountTimeSlotListPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetDataPartitionPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetNodePathsPartitionPlan;
 import org.apache.iotdb.confignode.consensus.request.read.partition.GetOrCreateDataPartitionPlan;
@@ -1271,9 +1272,7 @@ public class ConfigPhysicalPlanSerDeTest {
 
   @Test
   public void GetRegionIdPlanTest() throws IOException {
-    GetRegionIdPlan getRegionIdPlan0 =
-        new GetRegionIdPlan(
-            "root.test", ConfigRegion, new TSeriesPartitionSlot(1), new TTimePartitionSlot(0));
+    GetRegionIdPlan getRegionIdPlan0 = new GetRegionIdPlan(ConfigRegion);
     GetRegionIdPlan getRegionIdPlan1 =
         (GetRegionIdPlan)
             ConfigPhysicalPlan.Factory.create(getRegionIdPlan0.serializeToByteBuffer());
@@ -1282,14 +1281,22 @@ public class ConfigPhysicalPlanSerDeTest {
 
   @Test
   public void GetTimeSlotListPlanTest() throws IOException {
-    GetTimeSlotListPlan getTimeSlotListPlan0 =
-        new GetTimeSlotListPlan("root.test", new TSeriesPartitionSlot(1), 0, Long.MAX_VALUE);
+    GetTimeSlotListPlan getTimeSlotListPlan0 = new GetTimeSlotListPlan(0, Long.MAX_VALUE);
     GetTimeSlotListPlan getTimeSlotListPlan1 =
         (GetTimeSlotListPlan)
             ConfigPhysicalPlan.Factory.create(getTimeSlotListPlan0.serializeToByteBuffer());
     Assert.assertEquals(getTimeSlotListPlan0, getTimeSlotListPlan1);
   }
 
+  @Test
+  public void CountTimeSlotListPlanTest() throws IOException {
+    CountTimeSlotListPlan countTimeSlotListPlan0 = new CountTimeSlotListPlan(0, Long.MAX_VALUE);
+    CountTimeSlotListPlan countTimeSlotListPlan1 =
+        (CountTimeSlotListPlan)
+            ConfigPhysicalPlan.Factory.create(countTimeSlotListPlan0.serializeToByteBuffer());
+    Assert.assertEquals(countTimeSlotListPlan0, countTimeSlotListPlan1);
+  }
+
   @Test
   public void GetSeriesSlotListPlanTest() throws IOException {
     GetSeriesSlotListPlan getSeriesSlotListPlan0 =
diff --git a/docs/UserGuide/Cluster/Cluster-Maintenance.md b/docs/UserGuide/Cluster/Cluster-Maintenance.md
index 708c85f7b3..5250bd8f76 100644
--- a/docs/UserGuide/Cluster/Cluster-Maintenance.md
+++ b/docs/UserGuide/Cluster/Cluster-Maintenance.md
@@ -447,22 +447,33 @@ The cluster slots information can be shown by the following SQLs:
 
 ### Show the DataRegion where a DataPartition resides in
 
-Show the DataRegion where a DataPartition(or all DataPartitions under a same series slot) resides in:
-- `SHOW DATA REGIONID OF root.sg WHERE SERIESSLOTID=s0 (AND TIMESLOTID=t0)`
+Show the DataRegion where a DataPartition of a certain database or device resides in:
+
+- `SHOW DATA REGIONID WHERE (DATABASE=root.xxx |DEVICE=root.xxx.xxx) (AND TIME=xxxxx)?`
 
 Specifications:
 
-1. The s0, t0 must be numbers. 
+1. "DEVICE" corresponds to a unique SeriesSlot for the device path, while "TIME" corresponds to a unique SeriesTimeSlot for either a timestamp or a universal time.
    
-2. The "TimeSlotId" is short for "SeriesTimeSlotId".
+2. "DATABASE" and "DEVICE" must begin with "root". If the path does not exist, it will return empty instead of reporting an error, as will be seen below.
 
-3. The "SERIESSLOTID=s0" can be substituted by "DEVICEID=xxx.xx.xx". Using this, the sql will calculate the seriesSlot corresponding to that deviceId.
+3. Currently, "DATABASE" and "DEVICE" do not support wildcard matching or multiple queries. If it contains a wildcard character(such as * or **) or multiple DATABASE and DEVICE, an error will be reported, as will be seen below.
 
-4. The "TIMESLOTID=t0" can be replaced by "TIMESTAMP=t1". In this case, the sql will calculate the timeSlot the timestamp belongs to, which starts before the timeStamp and (implicitly) ends after it.
+4. "TIME" supports both timestamps and universal dates. For timestamp, it must be greater than or equal to 0. For universal time, it need to be no earlier than 1970-01-01 00:00:00.
 
 Eg:
 ```
-IoTDB> show data regionid of root.sg where seriesslotid=5286 and timeslotid=0
+IoTDB> show data regionid where device=root.sg.m1.d1
++--------+
+|RegionId|
++--------+
+|       1|
+|       2|
++--------+
+Total line number = 2
+It costs 0.006s
+
+IoTDB> show data regionid where device=root.sg.m1.d1 and time=604800000
 +--------+
 |RegionId|
 +--------+
@@ -471,7 +482,16 @@ IoTDB> show data regionid of root.sg where seriesslotid=5286 and timeslotid=0
 Total line number = 1
 It costs 0.006s
 
-IoTDB> show data regionid of root.sg where seriesslotid=5286
+IoTDB> show data regionid where device=root.sg.m1.d1 and time=1970-01-08T00:00:00.000
++--------+
+|RegionId|
++--------+
+|       1|
++--------+
+Total line number = 1
+It costs 0.006s
+
+IoTDB> show data regionid where database=root.sg
 +--------+
 |RegionId|
 +--------+
@@ -480,18 +500,35 @@ IoTDB> show data regionid of root.sg where seriesslotid=5286
 +--------+
 Total line number = 2
 It costs 0.006s
+
+IoTDB> show data regionid where database=root.sg and time=604800000
++--------+
+|RegionId|
++--------+
+|       1|
++--------+
+Total line number = 1
+It costs 0.006s
+
+IoTDB> show data regionid where database=root.sg and time=1970-01-08T00:00:00.000
++--------+
+|RegionId|
++--------+
+|       1|
++--------+
+Total line number = 1
+It costs 0.006s
 ```
 
 ### Show the SchemaRegion where a SchemaPartition resides in
 
-Show the SchemaRegion where a SchemaPartition resides in:
-- `SHOW SCHEMA REGIONID OF root.sg WHERE SERIESSLOTID=s0`
+Show the SchemaRegion where a DataPartition of a certain database or device resides in:
 
-As is illustrated above, the SeriesSlotID and TimeSlotID are both replaceable.
+- `SHOW SCHEMA REGIONID WHERE (DATABASE=root.xxx | DEVICE=root.xxx.xxx)`
 
 Eg:
 ```
-IoTDB> show schema regionid of root.sg where seriesslotid=5286
+IoTDB> show schema regionid where device=root.sg.m1.d2
 +--------+
 |RegionId|
 +--------+
@@ -499,34 +536,25 @@ IoTDB> show schema regionid of root.sg where seriesslotid=5286
 +--------+
 Total line number = 1
 It costs 0.007s
-```
 
-### Show the time slots of a series slot
-
-Show the time slots under a particular series slot.
-- `SHOW TIMESLOTID OF root.sg WHERE SERIESLOTID=s0 (AND STARTTIME=t1) (AND ENDTIME=t2)`
-
-Eg:
-```
-IoTDB> show timeslotid of root.sg where seriesslotid=5286
-+----------+
-|TimeSlotId|
-+----------+
-|         0|
-|      1000|
-+----------+
+IoTDB> show schema regionid where database=root.sg
++--------+
+|RegionId|
++--------+
+|       0|
++--------+
 Total line number = 1
 It costs 0.007s
 ```
 
 ### Show Database's series slots
 
-Show the data/schema/all series slots related to a database:
-- `SHOW (DATA|SCHEMA)? SERIESSLOTID OF root.sg`
+Show the data/schema series slots related to a database:
+- `SHOW (DATA|SCHEMA) SERIESSLOTID WHERE DATABASE=root.xxx`
 
 Eg:
 ```
-IoTDB> show data seriesslotid of root.sg
+IoTDB> show data seriesslotid where database = root.sg
 +------------+
 |SeriesSlotId|
 +------------+
@@ -535,7 +563,7 @@ IoTDB> show data seriesslotid of root.sg
 Total line number = 1
 It costs 0.007s
 
-IoTDB> show schema seriesslotid of root.sg
+IoTDB> show schema seriesslotid where database = root.sg
 +------------+
 |SeriesSlotId|
 +------------+
@@ -543,16 +571,88 @@ IoTDB> show schema seriesslotid of root.sg
 +------------+
 Total line number = 1
 It costs 0.006s
+```
 
-IoTDB> show seriesslotid of root.sg
-+------------+
-|SeriesSlotId|
-+------------+
-|        5286|
-+------------+
+### Show the time partition under filtering conditions.
+
+Show the TimePartition of a certain device, database, or DataRegion.
+
+- `SHOW TIMEPARTITION WHERE (DEVICE=root.a.b |REGIONID = r0 | DATABASE=root.xxx) (AND STARTTIME=t1)?(AND ENDTIME=t2)?`
+
+Specifications:
+
+1. TimePartition is short for SeriesTimeSlotId.
+2. If REGIONID is the Id of schemaRegion, return empty instead of reporting an error. 
+3. REGIONID do not support multiple queries. If it contains multiple REGIONID, an error will be reported, as will be seen below.
+4. "STARTTIME" and "ENDTIME" support both timestamps and universal dates. For timestamp, it must be greater than or equal to 0. For universal time, it need to be no earlier than 1970-01-01 00:00:00.
+5. The StartTime in the returned result is the starting time of the TimePartition's corresponding time interval.
+
+Eg:
+```
+IoTDB> show timePartition where device=root.sg.m1.d1
++-------------------------------------+
+|TimePartition|              StartTime|
++-------------------------------------+
+|            0|1970-01-01T00:00:00.000|
++-------------------------------------+
 Total line number = 1
-It costs 0.006s
+It costs 0.007s
+
+IoTDB> show timePartition where regionId = 1
++-------------------------------------+
+|TimePartition|              StartTime|
++-------------------------------------+
+|            0|1970-01-01T00:00:00.000|
++-------------------------------------+
+Total line number = 1
+It costs 0.007s
+
+IoTDB> show timePartition where database = root.sg 
++-------------------------------------+
+|TimePartition|              StartTime|
++-------------------------------------+
+|            0|1970-01-01T00:00:00.000|
++-------------------------------------+
+|            1|1970-01-08T00:00:00.000|
++-------------------------------------+
+Total line number = 2
+It costs 0.007s
+```
+#### Count the time partition under filtering conditions.
+
+Count the TimePartition of a certain device, database, or DataRegion.
+
+- `COUNT TIMEPARTITION WHERE (DEVICE=root.a.b |REGIONID = r0 | DATABASE=root.xxx) (AND STARTTIME=t1)?(AND ENDTIME=t2)?`
+
 ```
+IoTDB> count timePartition where device=root.sg.m1.d1
++--------------------+
+|count(timePartition)|
++--------------------+
+|                   1|
++--------------------+
+Total line number = 1
+It costs 0.007s
+
+IoTDB> count timePartition where regionId = 1
++--------------------+
+|count(timePartition)|
++--------------------+
+|                   1|
++--------------------+
+Total line number = 1
+It costs 0.007s
+
+IoTDB> count timePartition where database = root.sg 
++--------------------+
+|count(timePartition)|
++--------------------+
+|                   2|
++--------------------+
+Total line number = 1
+It costs 0.007s
+```
+
 
 ## Migrate Region
 The following sql can be applied to manually migrate a region, for load balancing or other purposes.
diff --git a/docs/zh/UserGuide/Cluster/Cluster-Maintenance.md b/docs/zh/UserGuide/Cluster/Cluster-Maintenance.md
index 84bc486703..69fd70d9c4 100644
--- a/docs/zh/UserGuide/Cluster/Cluster-Maintenance.md
+++ b/docs/zh/UserGuide/Cluster/Cluster-Maintenance.md
@@ -445,23 +445,33 @@ Region 继承所在 DataNode 的状态,对 Region 各状态定义如下:
 
 #### 展示数据分区所在的 DataRegion
 
-展示一个数据分区(或一个序列槽下的所有数据分区)所在的 DataRegion:
-- `SHOW DATA REGIONID OF root.sg WHERE SERIESSLOTID=s0 (AND TIMESLOTID=t0)`
+展示某数据库或某设备的数据分区所在的 DataRegion:
+- `- SHOW DATA REGIONID WHERE (DATABASE=root.xxx |DEVICE=root.xxx.xxx) (AND TIME=xxxxx)?`
   
 有如下几点说明:
 
-1. s0、t0均只能为数字。 
+1. DEVICE 为设备名对应唯一的 SeriesSlot,TIME 为时间戳或者通用时间对应唯一的 SeriesTimeSlot。
    
-2. TimeSlotId 是 SeriesTimeSlotId 的简称。
+2. DATABASE 和 DEVICE 必须以 root 开头,如果是不存在的路径时返回空,不报错,下同。
 
-2. ”SERIESSLOTID=s0”可以被替换为”DEVICEID=xxx.xx.xx“。 这样的话,sql会自动计算对应该设备id的序列槽。
+3. DATABASE 和 DEVICE 目前不支持通配符匹配或者批量查询,如果包含 * 或 ** 的通配符或者输入多个 DATABASE 和 DEVICE 则会报错,下同。
 
-3. 同样的,"TIMESLOTID=t0"也可以被替换为"TIMESTAMP=t1"。这样,SQL会计算该时间戳对应的时间槽,也就是时间段包含该时间戳的时间槽。
+4. TIME 支持时间戳和通用日期。对于时间戳,必须得大于等于0,对于通用日期,需要不早于1970-01-01 00:00:00
 
 
 示例:
 ```
-IoTDB> show data regionid of root.sg where seriesslotid=5286 and timeslotid=0
+IoTDB> show data regionid where device=root.sg.m1.d1
++--------+
+|RegionId|
++--------+
+|       1|
+|       2|
++--------+
+Total line number = 2
+It costs 0.006s
+
+IoTDB> show data regionid where device=root.sg.m1.d1 and time=604800000
 +--------+
 |RegionId|
 +--------+
@@ -470,7 +480,16 @@ IoTDB> show data regionid of root.sg where seriesslotid=5286 and timeslotid=0
 Total line number = 1
 It costs 0.006s
 
-IoTDB> show data regionid of root.sg where seriesslotid=5286
+IoTDB> show data regionid where device=root.sg.m1.d1 and time=1970-01-08T00:00:00.000
++--------+
+|RegionId|
++--------+
+|       1|
++--------+
+Total line number = 1
+It costs 0.006s
+
+IoTDB> show data regionid where database=root.sg
 +--------+
 |RegionId|
 +--------+
@@ -479,18 +498,35 @@ IoTDB> show data regionid of root.sg where seriesslotid=5286
 +--------+
 Total line number = 2
 It costs 0.006s
+
+IoTDB> show data regionid where database=root.sg and time=604800000
++--------+
+|RegionId|
++--------+
+|       1|
++--------+
+Total line number = 1
+It costs 0.006s
+
+IoTDB> show data regionid where database=root.sg and time=1970-01-08T00:00:00.000
++--------+
+|RegionId|
++--------+
+|       1|
++--------+
+Total line number = 1
+It costs 0.006s
 ```
 
 #### 展示元数据分区所在的 SchemaRegion
 
-展示一个元数据分区所在的 SchemaRegion:
-- `SHOW SCHEMA REGIONID OF root.sg WHERE SERIESSLOTID=s0`
+展示某数据库或某设备的元数据分区所在的 SchemaRegion:
+- `SHOW SCHEMA REGIONID WHERE (DATABASE=root.xxx | DEVICE=root.xxx.xxx)`
 
-同样的,”SERIESSLOTID“与”TIMESLOTID“依然是可替换的。
 
 示例:
 ```
-IoTDB> show schema regionid of root.sg where seriesslotid=5286
+IoTDB> show schema regionid where device=root.sg.m1.d2
 +--------+
 |RegionId|
 +--------+
@@ -498,32 +534,23 @@ IoTDB> show schema regionid of root.sg where seriesslotid=5286
 +--------+
 Total line number = 1
 It costs 0.007s
-```
 
-#### 展示序列槽下的时间槽
-展示一个序列槽下的所有时间槽:
-- `SHOW TIMESLOTID OF root.sg WHERE SERIESLOTID=s0 (AND STARTTIME=t1) (AND ENDTIME=t2)`
-
-示例:
-```
-IoTDB> show timeslotid of root.sg where seriesslotid=5286
-+----------+
-|TimeSlotId|
-+----------+
-|         0|
-|      1000|
-+----------+
+IoTDB> show schema regionid where database=root.sg
++--------+
+|RegionId|
++--------+
+|       0|
++--------+
 Total line number = 1
 It costs 0.007s
 ```
-
 #### 展示数据库的序列槽
-展示一个数据库内,数据,元数据或是所有的序列槽:
-- `SHOW (DATA|SCHEMA)? SERIESSLOTID OF root.sg`
+展示某数据库内数据或元数据的序列槽(SeriesSlot):
+- `SHOW (DATA|SCHEMA) SERIESSLOTID WHERE DATABASE=root.xxx`
 
 示例:
 ```
-IoTDB> show data seriesslotid of root.sg
+IoTDB> show data seriesslotid where database = root.sg
 +------------+
 |SeriesSlotId|
 +------------+
@@ -532,7 +559,7 @@ IoTDB> show data seriesslotid of root.sg
 Total line number = 1
 It costs 0.007s
 
-IoTDB> show schema seriesslotid of root.sg
+IoTDB> show schema seriesslotid where  database = root.sg
 +------------+
 |SeriesSlotId|
 +------------+
@@ -540,16 +567,90 @@ IoTDB> show schema seriesslotid of root.sg
 +------------+
 Total line number = 1
 It costs 0.006s
+```
 
-IoTDB> show seriesslotid of root.sg
-+------------+
-|SeriesSlotId|
-+------------+
-|        5286|
-+------------+
+#### 展示过滤条件下的时间分区
+展示某设备或某数据库或某dataRegion的时间分区(TimePartition):
+- `SHOW TIMEPARTITION WHERE (DEVICE=root.a.b |REGIONID = r0 | DATABASE=root.xxx) (AND STARTTIME=t1)?(AND ENDTIME=t2)?`
+
+有如下几点说明:
+
+1. TimePartition 是 SeriesTimeSlotId 的简称。
+
+2. REGIONID 如果为 schemaRegion 的 Id 返回空,不报错。
+3. REGIONID 不支持批量查询,如果输入多个 REGIONID 则会报错,下同。
+
+4. STARTTIME 和 ENDTIME 支持时间戳和通用日期。对于时间戳,必须得大于等于0,对于通用日期,需要不早于1970-01-01 00:00:00。
+
+5. 返回结果中的 StartTime 为 TimePartition 对应时间区间的起始时间。
+
+示例:
+```
+IoTDB> show timePartition where device=root.sg.m1.d1
++-------------------------------------+
+|TimePartition|              StartTime|
++-------------------------------------+
+|            0|1970-01-01T00:00:00.000|
++-------------------------------------+
 Total line number = 1
-It costs 0.006s
+It costs 0.007s
+
+IoTDB> show timePartition where regionId = 1
++-------------------------------------+
+|TimePartition|              StartTime|
++-------------------------------------+
+|            0|1970-01-01T00:00:00.000|
++-------------------------------------+
+Total line number = 1
+It costs 0.007s
+
+IoTDB> show timePartition where database = root.sg 
++-------------------------------------+
+|TimePartition|              StartTime|
++-------------------------------------+
+|            0|1970-01-01T00:00:00.000|
++-------------------------------------+
+|            1|1970-01-08T00:00:00.000|
++-------------------------------------+
+Total line number = 2
+It costs 0.007s
+```
+
+#### 统计过滤条件下的时间分区个数
+
+统计某设备或某数据库或某dataRegion的时间分区(TimePartition):
+
+- `COUNT TIMEPARTITION WHERE (DEVICE=root.a.b |REGIONID = r0 | DATABASE=root.xxx) (AND STARTTIME=t1)?(AND ENDTIME=t2)?`
+
 ```
+IoTDB> count timePartition where device=root.sg.m1.d1
++--------------------+
+|count(timePartition)|
++--------------------+
+|                   1|
++--------------------+
+Total line number = 1
+It costs 0.007s
+
+IoTDB> count timePartition where regionId = 1
++--------------------+
+|count(timePartition)|
++--------------------+
+|                   1|
++--------------------+
+Total line number = 1
+It costs 0.007s
+
+IoTDB> count timePartition where database = root.sg 
++--------------------+
+|count(timePartition)|
++--------------------+
+|                   2|
++--------------------+
+Total line number = 1
+It costs 0.007s
+```
+
 
 ### 迁移 Region
 以下 SQL 语句可以被用于手动迁移一个 region, 可用于负载均衡或其他目的。
diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionGetterIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionGetterIT.java
index 96c7ac7715..65d1bb6295 100644
--- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionGetterIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionGetterIT.java
@@ -22,9 +22,10 @@ import org.apache.iotdb.common.rpc.thrift.TConsensusGroupId;
 import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType;
 import org.apache.iotdb.common.rpc.thrift.TSStatus;
 import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
-import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
 import org.apache.iotdb.commons.client.sync.SyncConfigNodeIServiceClient;
 import org.apache.iotdb.confignode.it.utils.ConfigNodeTestUtils;
+import org.apache.iotdb.confignode.rpc.thrift.TCountTimeSlotListReq;
+import org.apache.iotdb.confignode.rpc.thrift.TCountTimeSlotListResp;
 import org.apache.iotdb.confignode.rpc.thrift.TDataNodeInfo;
 import org.apache.iotdb.confignode.rpc.thrift.TDataPartitionReq;
 import org.apache.iotdb.confignode.rpc.thrift.TDataPartitionTableResp;
@@ -58,7 +59,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.nio.ByteBuffer;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Map;
@@ -351,46 +351,35 @@ public class IoTDBPartitionGetterIT {
       /* Test getRegionId */
       TGetRegionIdReq getRegionIdReq;
       TGetRegionIdResp getRegionIdResp;
-      TSeriesPartitionSlot seriesPartitionSlot = new TSeriesPartitionSlot(0);
-      TTimePartitionSlot timePartitionSlot = new TTimePartitionSlot(0L);
 
-      // Get RegionIds of specified PartitionSlot
-      getRegionIdReq = new TGetRegionIdReq(sg0, TConsensusGroupType.DataRegion);
-      getRegionIdReq.setSeriesSlotId(seriesPartitionSlot);
-      getRegionIdReq.setTimeSlotId(timePartitionSlot);
+      // Get RegionIds of specified database and timestamp
+      getRegionIdReq = new TGetRegionIdReq(TConsensusGroupType.DataRegion);
+      getRegionIdReq.setDatabase(sg0);
+      getRegionIdReq.setTimeStamp(0);
       getRegionIdResp = client.getRegionId(getRegionIdReq);
       Assert.assertEquals(
           TSStatusCode.SUCCESS_STATUS.getStatusCode(), getRegionIdResp.status.getCode());
-      Assert.assertEquals(1, getRegionIdResp.getDataRegionIdListSize());
 
-      // Get RegionId with wrong PartitionSlot
+      //           Get RegionId with wrong PartitionSlot
       getRegionIdReq.setType(TConsensusGroupType.SchemaRegion);
       getRegionIdResp = client.getRegionId(getRegionIdReq);
       Assert.assertEquals(
           TSStatusCode.ILLEGAL_PARAMETER.getStatusCode(), getRegionIdResp.status.getCode());
 
-      // Get RegionId with wrong RegionType
-      getRegionIdReq.setType(TConsensusGroupType.ConfigRegion);
-      getRegionIdResp = client.getRegionId(getRegionIdReq);
-      Assert.assertEquals(
-          TSStatusCode.ILLEGAL_PARAMETER.getStatusCode(), getRegionIdResp.status.getCode());
-
-      // Get all RegionIds within one SeriesSlot
+      // Get all RegionIds within database
       for (int i = 0; i < storageGroupNum; i++) {
         String curSg = sg + i;
-
-        getRegionIdReq = new TGetRegionIdReq(curSg, TConsensusGroupType.DataRegion);
-        getRegionIdReq.setSeriesSlotId(seriesPartitionSlot);
+        getRegionIdReq = new TGetRegionIdReq(TConsensusGroupType.DataRegion);
+        getRegionIdReq.setDatabase(curSg);
         getRegionIdResp = client.getRegionId(getRegionIdReq);
         Assert.assertEquals(
             TSStatusCode.SUCCESS_STATUS.getStatusCode(), getRegionIdResp.status.getCode());
         Set<TConsensusGroupId> idSet = new HashSet<>(getRegionIdResp.getDataRegionIdList());
-
         Set<TConsensusGroupId> subSets = new HashSet<>();
         for (long j = 0; j < testTimePartitionSlotsNum; j++) {
-          TGetRegionIdReq subReq = new TGetRegionIdReq(curSg, TConsensusGroupType.DataRegion);
-          subReq.setSeriesSlotId(seriesPartitionSlot);
-          subReq.setTimeSlotId(new TTimePartitionSlot(j * testTimePartitionInterval));
+          TGetRegionIdReq subReq = new TGetRegionIdReq(TConsensusGroupType.DataRegion);
+          subReq.setDatabase(curSg);
+          subReq.setTimeStamp(j * testTimePartitionInterval);
           TGetRegionIdResp subResp = client.getRegionId(subReq);
           Assert.assertEquals(
               TSStatusCode.SUCCESS_STATUS.getStatusCode(), subResp.getStatus().getCode());
@@ -406,28 +395,16 @@ public class IoTDBPartitionGetterIT {
       TSchemaPartitionTableResp schemaPartitionTableResp =
           client.getSchemaPartitionTable(schemaPartitionReq);
       getRegionIdReq.setDatabase(sg0);
-      getRegionIdReq.setSeriesSlotId(
-          new ArrayList<>(schemaPartitionTableResp.getSchemaPartitionTable().get(sg0).keySet())
-              .get(0));
       getRegionIdReq.setType(TConsensusGroupType.SchemaRegion);
       getRegionIdResp = client.getRegionId(getRegionIdReq);
       Assert.assertEquals(
           TSStatusCode.SUCCESS_STATUS.getStatusCode(), getRegionIdResp.status.getCode());
-      Assert.assertEquals(1, getRegionIdResp.getDataRegionIdListSize());
-
-      getRegionIdReq.setType(TConsensusGroupType.ConfigRegion);
-      getRegionIdResp = client.getRegionId(getRegionIdReq);
-      Assert.assertEquals(
-          TSStatusCode.SUCCESS_STATUS.getStatusCode(), getRegionIdResp.status.getCode());
-      Assert.assertEquals(0, getRegionIdResp.getDataRegionIdListSize());
 
       // Test GetTimeSlotList api
       TGetTimeSlotListReq getTimeSlotListReq;
       TGetTimeSlotListResp getTimeSlotListResp;
-
-      seriesPartitionSlot.setSlotId(0);
-
-      getTimeSlotListReq = new TGetTimeSlotListReq(sg0, seriesPartitionSlot);
+      getTimeSlotListReq = new TGetTimeSlotListReq();
+      getTimeSlotListReq.setDatabase(sg0);
       getTimeSlotListResp = client.getTimeSlotList(getTimeSlotListReq);
       Assert.assertEquals(
           TSStatusCode.SUCCESS_STATUS.getStatusCode(), getTimeSlotListResp.status.getCode());
@@ -450,39 +427,46 @@ public class IoTDBPartitionGetterIT {
           TSStatusCode.SUCCESS_STATUS.getStatusCode(), getTimeSlotListResp.status.getCode());
       Assert.assertEquals(endTime - startTime, getTimeSlotListResp.getTimeSlotListSize());
 
-      // Test GetSeriesSlotList api
-      TGetSeriesSlotListReq getSeriesSlotListReq;
-      TGetSeriesSlotListResp getSeriesSlotListResp;
+      // Test CountTimeSlotList api
+      TCountTimeSlotListReq countTimeSlotListReq;
+      TCountTimeSlotListResp countTimeSlotListResp;
+      countTimeSlotListReq = new TCountTimeSlotListReq();
+      countTimeSlotListReq.setDatabase(sg0);
+      countTimeSlotListResp = client.countTimeSlotList(countTimeSlotListReq);
+      Assert.assertEquals(
+          TSStatusCode.SUCCESS_STATUS.getStatusCode(), countTimeSlotListResp.status.getCode());
+      Assert.assertEquals(timePartitionBatchSize, countTimeSlotListResp.getCount());
 
-      getSeriesSlotListReq = new TGetSeriesSlotListReq(sg0);
-      getSeriesSlotListResp = client.getSeriesSlotList(getSeriesSlotListReq);
+      countTimeSlotListReq.setStartTime(startTime * testTimePartitionInterval);
+
+      countTimeSlotListResp = client.countTimeSlotList(countTimeSlotListReq);
       Assert.assertEquals(
-          TSStatusCode.SUCCESS_STATUS.getStatusCode(), getSeriesSlotListResp.status.getCode());
+          TSStatusCode.SUCCESS_STATUS.getStatusCode(), countTimeSlotListResp.status.getCode());
+      Assert.assertEquals(timePartitionBatchSize - startTime, countTimeSlotListResp.getCount());
+
+      countTimeSlotListReq.setEndTime(endTime * testTimePartitionInterval);
+
+      countTimeSlotListResp = client.countTimeSlotList(countTimeSlotListReq);
       Assert.assertEquals(
-          testSeriesPartitionSlotNum + 2, getSeriesSlotListResp.getSeriesSlotListSize());
+          TSStatusCode.SUCCESS_STATUS.getStatusCode(), countTimeSlotListResp.status.getCode());
+      Assert.assertEquals(endTime - startTime, countTimeSlotListResp.getCount());
 
-      getSeriesSlotListReq.setType(TConsensusGroupType.ConfigRegion);
+      // Test GetSeriesSlotList api
+      TGetSeriesSlotListReq getSeriesSlotListReq;
+      TGetSeriesSlotListResp getSeriesSlotListResp;
 
+      getSeriesSlotListReq = new TGetSeriesSlotListReq(sg0, TConsensusGroupType.DataRegion);
       getSeriesSlotListResp = client.getSeriesSlotList(getSeriesSlotListReq);
       Assert.assertEquals(
           TSStatusCode.SUCCESS_STATUS.getStatusCode(), getSeriesSlotListResp.status.getCode());
       Assert.assertEquals(
-          testSeriesPartitionSlotNum + 2, getSeriesSlotListResp.getSeriesSlotListSize());
+          testSeriesPartitionSlotNum, getSeriesSlotListResp.getSeriesSlotListSize());
 
       getSeriesSlotListReq.setType(TConsensusGroupType.SchemaRegion);
-
       getSeriesSlotListResp = client.getSeriesSlotList(getSeriesSlotListReq);
       Assert.assertEquals(
           TSStatusCode.SUCCESS_STATUS.getStatusCode(), getSeriesSlotListResp.status.getCode());
       Assert.assertEquals(2, getSeriesSlotListResp.getSeriesSlotListSize());
-
-      getSeriesSlotListReq.setType(TConsensusGroupType.DataRegion);
-
-      getSeriesSlotListResp = client.getSeriesSlotList(getSeriesSlotListReq);
-      Assert.assertEquals(
-          TSStatusCode.SUCCESS_STATUS.getStatusCode(), getSeriesSlotListResp.status.getCode());
-      Assert.assertEquals(
-          testSeriesPartitionSlotNum, getSeriesSlotListResp.getSeriesSlotListSize());
     }
   }
 
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartitionTable.java b/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartitionTable.java
index 063f675054..6195b9b3b4 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartitionTable.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartitionTable.java
@@ -173,25 +173,52 @@ public class DataPartitionTable {
    *
    * @param seriesSlotId SeriesPartitionSlot
    * @param timeSlotId TimePartitionSlot
-   * @return the timePartition's corresponding dataRegionIds, if timeSlotId == -1, then return all
-   *     the seriesSlot's dataRegionIds
+   * @return the timePartition's corresponding dataRegionIds, if seriesSlotId==-1, then return all
+   *     seriesPartitionTable's dataRegionIds; if timeSlotId == -1, then return all the seriesSlot's
+   *     dataRegionIds.
    */
   public List<TConsensusGroupId> getRegionId(
       TSeriesPartitionSlot seriesSlotId, TTimePartitionSlot timeSlotId) {
-    if (!dataPartitionMap.containsKey(seriesSlotId)) {
+    if (seriesSlotId.getSlotId() == -1) {
+      List<TConsensusGroupId> regionIds = new ArrayList<>();
+      dataPartitionMap.forEach(
+          (seriesPartitionSlot, seriesPartitionTable) ->
+              regionIds.addAll(seriesPartitionTable.getRegionId(timeSlotId)));
+      return regionIds;
+    } else if (!dataPartitionMap.containsKey(seriesSlotId)) {
       return new ArrayList<>();
+    } else {
+      SeriesPartitionTable seriesPartitionTable = dataPartitionMap.get(seriesSlotId);
+      return seriesPartitionTable.getRegionId(timeSlotId);
     }
-    SeriesPartitionTable seriesPartitionTable = dataPartitionMap.get(seriesSlotId);
-    return seriesPartitionTable.getRegionId(timeSlotId);
   }
 
+  /**
+   * Query timePartition
+   *
+   * @param seriesSlotId SeriesPartitionSlot
+   * @param regionId TConsensusGroupId
+   * @param startTime startTime
+   * @return the timePartition if seriesSlotId==-1&&regionId == -1, then return all timePartition;
+   *     if timeSlotId == -1, then return all the seriesSlot's dataRegionIds.
+   */
   public List<TTimePartitionSlot> getTimeSlotList(
-      TSeriesPartitionSlot seriesSlotId, long startTime, long endTime) {
-    if (!dataPartitionMap.containsKey(seriesSlotId)) {
+      TSeriesPartitionSlot seriesSlotId, TConsensusGroupId regionId, long startTime, long endTime) {
+    if (seriesSlotId.getSlotId() == -1) {
+      // query timePartition of specific database or region
+      List<TTimePartitionSlot> timePartitionSlots = new ArrayList<>();
+      dataPartitionMap.forEach(
+          (seriesPartitionSlot, seriesPartitionTable) ->
+              timePartitionSlots.addAll(
+                  seriesPartitionTable.getTimeSlotList(regionId, startTime, endTime)));
+      return timePartitionSlots;
+    } else if (!dataPartitionMap.containsKey(seriesSlotId)) {
       return new ArrayList<>();
+    } else {
+      // query timePartition of specific seriesPartition
+      SeriesPartitionTable seriesPartitionTable = dataPartitionMap.get(seriesSlotId);
+      return seriesPartitionTable.getTimeSlotList(regionId, startTime, endTime);
     }
-    SeriesPartitionTable seriesPartitionTable = dataPartitionMap.get(seriesSlotId);
-    return seriesPartitionTable.getTimeSlotList(startTime, endTime);
   }
 
   public List<TSeriesPartitionSlot> getSeriesSlotList() {
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/partition/SchemaPartitionTable.java b/node-commons/src/main/java/org/apache/iotdb/commons/partition/SchemaPartitionTable.java
index a281478f59..dca91073f2 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/partition/SchemaPartitionTable.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/partition/SchemaPartitionTable.java
@@ -135,7 +135,17 @@ public class SchemaPartitionTable {
     return result;
   }
 
+  /**
+   * Query a timePartition's corresponding schemaRegionIds
+   *
+   * @param seriesSlotId SeriesPartitionSlot
+   * @return the timePartition's corresponding dataRegionIds, if seriesSlotId==-1, then return all
+   *     seriesPartitionTable's schemaRegionIds;
+   */
   public List<TConsensusGroupId> getRegionId(TSeriesPartitionSlot seriesSlotId) {
+    if (seriesSlotId.getSlotId() == -1) {
+      return new ArrayList<>(schemaPartitionMap.values());
+    }
     if (!schemaPartitionMap.containsKey(seriesSlotId)) {
       return new ArrayList<>();
     }
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/partition/SeriesPartitionTable.java b/node-commons/src/main/java/org/apache/iotdb/commons/partition/SeriesPartitionTable.java
index f6b790b47b..9f8b06fe85 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/partition/SeriesPartitionTable.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/partition/SeriesPartitionTable.java
@@ -34,12 +34,9 @@ import java.io.OutputStream;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
-import java.util.Set;
 import java.util.Vector;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -149,27 +146,30 @@ public class SeriesPartitionTable {
    * @return the timePartition's corresponding dataRegionIds
    */
   List<TConsensusGroupId> getRegionId(TTimePartitionSlot timeSlotId) {
-    if (timeSlotId != null) {
+    if (timeSlotId.getStartTime() != -1) {
       if (!seriesPartitionMap.containsKey(timeSlotId)) {
         return new ArrayList<>();
       }
-      return seriesPartitionMap.get(timeSlotId).stream()
-          .sorted(Comparator.comparing(TConsensusGroupId::getId))
-          .collect(Collectors.toList());
+      return seriesPartitionMap.get(timeSlotId);
     } else {
-      Set<TConsensusGroupId> result = new HashSet<>();
-      seriesPartitionMap.values().forEach(result::addAll);
-      return result.stream()
-          .sorted(Comparator.comparing(TConsensusGroupId::getId))
+      return seriesPartitionMap.values().stream()
+          .flatMap(List::stream)
           .collect(Collectors.toList());
     }
   }
 
-  List<TTimePartitionSlot> getTimeSlotList(long startTime, long endTime) {
-    return seriesPartitionMap.keySet().stream()
-        .filter(e -> e.getStartTime() >= startTime && e.getStartTime() < endTime)
-        .sorted(Comparator.comparing(TTimePartitionSlot::getStartTime))
-        .collect(Collectors.toList());
+  List<TTimePartitionSlot> getTimeSlotList(
+      TConsensusGroupId regionId, long startTime, long endTime) {
+    if (regionId.getId() == -1) {
+      return seriesPartitionMap.keySet().stream()
+          .filter(e -> e.getStartTime() >= startTime && e.getStartTime() < endTime)
+          .collect(Collectors.toList());
+    } else {
+      return seriesPartitionMap.keySet().stream()
+          .filter(e -> e.getStartTime() >= startTime && e.getStartTime() < endTime)
+          .filter(e -> seriesPartitionMap.get(e).contains(regionId))
+          .collect(Collectors.toList());
+    }
   }
 
   /**
diff --git a/server/src/main/java/org/apache/iotdb/db/client/ConfigNodeClient.java b/server/src/main/java/org/apache/iotdb/db/client/ConfigNodeClient.java
index 265a62e002..ca35b446fc 100644
--- a/server/src/main/java/org/apache/iotdb/db/client/ConfigNodeClient.java
+++ b/server/src/main/java/org/apache/iotdb/db/client/ConfigNodeClient.java
@@ -43,6 +43,8 @@ import org.apache.iotdb.confignode.rpc.thrift.TConfigNodeRegisterReq;
 import org.apache.iotdb.confignode.rpc.thrift.TConfigNodeRegisterResp;
 import org.apache.iotdb.confignode.rpc.thrift.TConfigNodeRestartReq;
 import org.apache.iotdb.confignode.rpc.thrift.TCountDatabaseResp;
+import org.apache.iotdb.confignode.rpc.thrift.TCountTimeSlotListReq;
+import org.apache.iotdb.confignode.rpc.thrift.TCountTimeSlotListResp;
 import org.apache.iotdb.confignode.rpc.thrift.TCreateCQReq;
 import org.apache.iotdb.confignode.rpc.thrift.TCreateFunctionReq;
 import org.apache.iotdb.confignode.rpc.thrift.TCreateModelReq;
@@ -1936,6 +1938,26 @@ public class ConfigNodeClient implements IConfigNodeRPCService.Iface, ThriftClie
     throw new TException(MSG_RECONNECTION_FAIL);
   }
 
+  public TCountTimeSlotListResp countTimeSlotList(TCountTimeSlotListReq req) throws TException {
+    for (int i = 0; i < RETRY_NUM; i++) {
+      try {
+        TCountTimeSlotListResp resp = client.countTimeSlotList(req);
+        if (!updateConfigNodeLeader(resp.getStatus())) {
+          return resp;
+        }
+      } catch (TException e) {
+        logger.warn(
+            "Failed to connect to ConfigNode {} from DataNode {} when executing {}",
+            configNode,
+            config.getAddressAndPort(),
+            Thread.currentThread().getStackTrace()[1].getMethodName());
+        configLeader = null;
+      }
+      waitAndReconnect();
+    }
+    throw new TException(MSG_RECONNECTION_FAIL);
+  }
+
   @Override
   public TGetSeriesSlotListResp getSeriesSlotList(TGetSeriesSlotListReq req) throws TException {
     for (int i = 0; i < RETRY_NUM; i++) {
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/header/ColumnHeaderConstant.java b/server/src/main/java/org/apache/iotdb/db/mpp/common/header/ColumnHeaderConstant.java
index 7f2e41bf82..824fa23ce0 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/common/header/ColumnHeaderConstant.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/common/header/ColumnHeaderConstant.java
@@ -125,7 +125,9 @@ public class ColumnHeaderConstant {
   public static final String DATA_NODE_ID = "DataNodeId";
   public static final String TIME_SLOT_NUM = "TimeSlotNum";
   public static final String SERIES_SLOT_ID = "SeriesSlotId";
-  public static final String TIME_SLOT_ID = "TimeSlotId";
+  public static final String TIME_PARTITION = "TimePartition";
+  public static final String COUNT_TIME_PARTITION = "count(timePartition)";
+  public static final String START_TIME = "StartTime";
   public static final String ROLE = "Role";
   public static final String CREATE_TIME = "CreateTime";
 
@@ -398,7 +400,12 @@ public class ColumnHeaderConstant {
       ImmutableList.of(new ColumnHeader(REGION_ID, TSDataType.INT32));
 
   public static final List<ColumnHeader> getTimeSlotListColumnHeaders =
-      ImmutableList.of(new ColumnHeader(TIME_SLOT_ID, TSDataType.INT64));
+      ImmutableList.of(
+          new ColumnHeader(TIME_PARTITION, TSDataType.INT64),
+          new ColumnHeader(START_TIME, TSDataType.TEXT));
+
+  public static final List<ColumnHeader> countTimeSlotListColumnHeaders =
+      ImmutableList.of(new ColumnHeader(COUNT_TIME_PARTITION, TSDataType.INT64));
 
   public static final List<ColumnHeader> getSeriesSlotListColumnHeaders =
       ImmutableList.of(new ColumnHeader(SERIES_SLOT_ID, TSDataType.INT32));
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/header/DatasetHeaderFactory.java b/server/src/main/java/org/apache/iotdb/db/mpp/common/header/DatasetHeaderFactory.java
index de1736d99f..6652bcfa2f 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/common/header/DatasetHeaderFactory.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/common/header/DatasetHeaderFactory.java
@@ -155,6 +155,10 @@ public class DatasetHeaderFactory {
     return new DatasetHeader(ColumnHeaderConstant.getTimeSlotListColumnHeaders, true);
   }
 
+  public static DatasetHeader getCountTimeSlotListHeader() {
+    return new DatasetHeader(ColumnHeaderConstant.countTimeSlotListColumnHeaders, true);
+  }
+
   public static DatasetHeader getSelectIntoHeader(boolean isAlignByDevice) {
     return isAlignByDevice
         ? new DatasetHeader(ColumnHeaderConstant.selectIntoAlignByDeviceColumnHeaders, true)
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/ConfigTaskVisitor.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/ConfigTaskVisitor.java
index 18e706c47a..b6fe7fcb05 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/ConfigTaskVisitor.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/ConfigTaskVisitor.java
@@ -20,6 +20,7 @@
 package org.apache.iotdb.db.mpp.plan.execution.config;
 
 import org.apache.iotdb.db.mpp.plan.execution.config.metadata.CountDatabaseTask;
+import org.apache.iotdb.db.mpp.plan.execution.config.metadata.CountTimeSlotListTask;
 import org.apache.iotdb.db.mpp.plan.execution.config.metadata.CreateContinuousQueryTask;
 import org.apache.iotdb.db.mpp.plan.execution.config.metadata.CreateFunctionTask;
 import org.apache.iotdb.db.mpp.plan.execution.config.metadata.CreatePipePluginTask;
@@ -85,6 +86,7 @@ import org.apache.iotdb.db.mpp.plan.statement.Statement;
 import org.apache.iotdb.db.mpp.plan.statement.StatementNode;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CountDatabaseStatement;
+import org.apache.iotdb.db.mpp.plan.statement.metadata.CountTimeSlotListStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CreateContinuousQueryStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CreateFunctionStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CreatePipePluginStatement;
@@ -447,6 +449,11 @@ public class ConfigTaskVisitor
     return new GetTimeSlotListTask(getTimeSlotListStatement);
   }
 
+  public IConfigTask visitCountTimeSlotList(
+      CountTimeSlotListStatement countTimeSlotListStatement, TaskContext context) {
+    return new CountTimeSlotListTask(countTimeSlotListStatement);
+  }
+
   @Override
   public IConfigTask visitMigrateRegion(
       MigrateRegionStatement migrateRegionStatement, TaskContext context) {
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/executor/ClusterConfigTaskExecutor.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/executor/ClusterConfigTaskExecutor.java
index cecd844275..3119043f3f 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/executor/ClusterConfigTaskExecutor.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/executor/ClusterConfigTaskExecutor.java
@@ -43,6 +43,8 @@ import org.apache.iotdb.commons.udf.service.UDFClassLoader;
 import org.apache.iotdb.commons.udf.service.UDFExecutableManager;
 import org.apache.iotdb.confignode.rpc.thrift.TAlterSchemaTemplateReq;
 import org.apache.iotdb.confignode.rpc.thrift.TCountDatabaseResp;
+import org.apache.iotdb.confignode.rpc.thrift.TCountTimeSlotListReq;
+import org.apache.iotdb.confignode.rpc.thrift.TCountTimeSlotListResp;
 import org.apache.iotdb.confignode.rpc.thrift.TCreateCQReq;
 import org.apache.iotdb.confignode.rpc.thrift.TCreateFunctionReq;
 import org.apache.iotdb.confignode.rpc.thrift.TCreateModelReq;
@@ -108,6 +110,7 @@ import org.apache.iotdb.db.mpp.plan.analyze.Analysis;
 import org.apache.iotdb.db.mpp.plan.analyze.Analyzer;
 import org.apache.iotdb.db.mpp.plan.execution.config.ConfigTaskResult;
 import org.apache.iotdb.db.mpp.plan.execution.config.metadata.CountDatabaseTask;
+import org.apache.iotdb.db.mpp.plan.execution.config.metadata.CountTimeSlotListTask;
 import org.apache.iotdb.db.mpp.plan.execution.config.metadata.DatabaseSchemaTask;
 import org.apache.iotdb.db.mpp.plan.execution.config.metadata.GetRegionIdTask;
 import org.apache.iotdb.db.mpp.plan.execution.config.metadata.GetSeriesSlotListTask;
@@ -134,6 +137,7 @@ import org.apache.iotdb.db.mpp.plan.execution.config.sys.quota.ShowThrottleQuota
 import org.apache.iotdb.db.mpp.plan.execution.config.sys.sync.ShowPipeSinkTask;
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CountDatabaseStatement;
+import org.apache.iotdb.db.mpp.plan.statement.metadata.CountTimeSlotListStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CreateContinuousQueryStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CreateFunctionStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CreatePipePluginStatement;
@@ -1152,7 +1156,7 @@ public class ClusterConfigTaskExecutor implements IConfigTaskExecutor {
       future.setException(e);
     }
 
-    // filter the regions by nodeid
+    // filter the regions by nodeId
     if (showRegionStatement.getNodeIds() != null) {
       List<TRegionInfo> regionInfos = showRegionResp.getRegionInfoList();
       regionInfos =
@@ -1698,16 +1702,13 @@ public class ClusterConfigTaskExecutor implements IConfigTaskExecutor {
     try (ConfigNodeClient configNodeClient =
         CONFIG_NODE_CLIENT_MANAGER.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) {
       TGetRegionIdReq tGetRegionIdReq =
-          new TGetRegionIdReq(
-              getRegionIdStatement.getStorageGroup(), getRegionIdStatement.getPartitionType());
-      if (getRegionIdStatement.getSeriesSlotId() != null) {
-        tGetRegionIdReq.setSeriesSlotId(getRegionIdStatement.getSeriesSlotId());
+          new TGetRegionIdReq(getRegionIdStatement.getPartitionType());
+      if (getRegionIdStatement.getDevice() != null) {
+        tGetRegionIdReq.setDevice(getRegionIdStatement.getDevice());
       } else {
-        tGetRegionIdReq.setDeviceId(getRegionIdStatement.getDeviceId());
+        tGetRegionIdReq.setDatabase(getRegionIdStatement.getDatabase());
       }
-      if (getRegionIdStatement.getTimeSlotId() != null) {
-        tGetRegionIdReq.setTimeSlotId(getRegionIdStatement.getTimeSlotId());
-      } else if (getRegionIdStatement.getTimeStamp() != -1) {
+      if (getRegionIdStatement.getTimeStamp() >= 0) {
         tGetRegionIdReq.setTimeStamp(getRegionIdStatement.getTimeStamp());
       }
       resp = configNodeClient.getRegionId(tGetRegionIdReq);
@@ -1730,10 +1731,9 @@ public class ClusterConfigTaskExecutor implements IConfigTaskExecutor {
     try (ConfigNodeClient configNodeClient =
         CONFIG_NODE_CLIENT_MANAGER.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) {
       TGetSeriesSlotListReq tGetSeriesSlotListReq =
-          new TGetSeriesSlotListReq(getSeriesSlotListStatement.getStorageGroup());
-      if (getSeriesSlotListStatement.getPartitionType() != null) {
-        tGetSeriesSlotListReq.setType(getSeriesSlotListStatement.getPartitionType());
-      }
+          new TGetSeriesSlotListReq(
+              getSeriesSlotListStatement.getDatabase(),
+              getSeriesSlotListStatement.getPartitionType());
       resp = configNodeClient.getSeriesSlotList(tGetSeriesSlotListReq);
       if (resp.getStatus().getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
         future.setException(new IoTDBException(resp.getStatus().message, resp.getStatus().code));
@@ -1753,10 +1753,14 @@ public class ClusterConfigTaskExecutor implements IConfigTaskExecutor {
     TGetTimeSlotListResp resp = new TGetTimeSlotListResp();
     try (ConfigNodeClient configNodeClient =
         CONFIG_NODE_CLIENT_MANAGER.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) {
-      TGetTimeSlotListReq tGetTimeSlotListReq =
-          new TGetTimeSlotListReq(
-              getTimeSlotListStatement.getStorageGroup(),
-              getTimeSlotListStatement.getSeriesSlotId());
+      TGetTimeSlotListReq tGetTimeSlotListReq = new TGetTimeSlotListReq();
+      if (getTimeSlotListStatement.getDatabase() != null) {
+        tGetTimeSlotListReq.setDatabase(getTimeSlotListStatement.getDatabase());
+      } else if (getTimeSlotListStatement.getDevice() != null) {
+        tGetTimeSlotListReq.setDevice(getTimeSlotListStatement.getDevice());
+      } else if (getTimeSlotListStatement.getRegionId() != -1) {
+        tGetTimeSlotListReq.setRegionId(getTimeSlotListStatement.getRegionId());
+      }
       if (getTimeSlotListStatement.getStartTime() != -1) {
         tGetTimeSlotListReq.setStartTime(getTimeSlotListStatement.getStartTime());
       }
@@ -1775,6 +1779,39 @@ public class ClusterConfigTaskExecutor implements IConfigTaskExecutor {
     return future;
   }
 
+  @Override
+  public SettableFuture<ConfigTaskResult> countTimeSlotList(
+      CountTimeSlotListStatement countTimeSlotListStatement) {
+    SettableFuture<ConfigTaskResult> future = SettableFuture.create();
+    TCountTimeSlotListResp resp = new TCountTimeSlotListResp();
+    try (ConfigNodeClient configNodeClient =
+        CONFIG_NODE_CLIENT_MANAGER.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) {
+      TCountTimeSlotListReq tCountTimeSlotListReq = new TCountTimeSlotListReq();
+      if (countTimeSlotListStatement.getDatabase() != null) {
+        tCountTimeSlotListReq.setDatabase(countTimeSlotListStatement.getDatabase());
+      } else if (countTimeSlotListStatement.getDevice() != null) {
+        tCountTimeSlotListReq.setDevice(countTimeSlotListStatement.getDevice());
+      } else if (countTimeSlotListStatement.getRegionId() != -1) {
+        tCountTimeSlotListReq.setRegionId(countTimeSlotListStatement.getRegionId());
+      }
+      if (countTimeSlotListStatement.getStartTime() != -1) {
+        tCountTimeSlotListReq.setStartTime(countTimeSlotListStatement.getStartTime());
+      }
+      if (countTimeSlotListStatement.getEndTime() != -1) {
+        tCountTimeSlotListReq.setEndTime(countTimeSlotListStatement.getEndTime());
+      }
+      resp = configNodeClient.countTimeSlotList(tCountTimeSlotListReq);
+      if (resp.getStatus().getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+        future.setException(new IoTDBException(resp.getStatus().message, resp.getStatus().code));
+        return future;
+      }
+    } catch (Exception e) {
+      future.setException(e);
+    }
+    CountTimeSlotListTask.buildTSBlock(resp, future);
+    return future;
+  }
+
   @Override
   public SettableFuture<ConfigTaskResult> migrateRegion(
       MigrateRegionStatement migrateRegionStatement) {
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/executor/IConfigTaskExecutor.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/executor/IConfigTaskExecutor.java
index 21f7c11ae9..3bb992ca6d 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/executor/IConfigTaskExecutor.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/executor/IConfigTaskExecutor.java
@@ -25,6 +25,7 @@ import org.apache.iotdb.confignode.rpc.thrift.TSpaceQuotaResp;
 import org.apache.iotdb.confignode.rpc.thrift.TThrottleQuotaResp;
 import org.apache.iotdb.db.mpp.plan.execution.config.ConfigTaskResult;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CountDatabaseStatement;
+import org.apache.iotdb.db.mpp.plan.statement.metadata.CountTimeSlotListStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CreateContinuousQueryStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CreateFunctionStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CreatePipePluginStatement;
@@ -178,6 +179,9 @@ public interface IConfigTaskExecutor {
   SettableFuture<ConfigTaskResult> getTimeSlotList(
       GetTimeSlotListStatement getTimeSlotListStatement);
 
+  SettableFuture<ConfigTaskResult> countTimeSlotList(
+      CountTimeSlotListStatement countTimeSlotListStatement);
+
   SettableFuture<ConfigTaskResult> migrateRegion(MigrateRegionStatement migrateRegionStatement);
 
   SettableFuture<ConfigTaskResult> createContinuousQuery(
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/metadata/GetTimeSlotListTask.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/metadata/CountTimeSlotListTask.java
similarity index 66%
copy from server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/metadata/GetTimeSlotListTask.java
copy to server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/metadata/CountTimeSlotListTask.java
index 27d6381f4c..a3515c7d7d 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/metadata/GetTimeSlotListTask.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/metadata/CountTimeSlotListTask.java
@@ -19,9 +19,7 @@
 
 package org.apache.iotdb.db.mpp.plan.execution.config.metadata;
 
-import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
-import org.apache.iotdb.confignode.rpc.thrift.TGetTimeSlotListResp;
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.confignode.rpc.thrift.TCountTimeSlotListResp;
 import org.apache.iotdb.db.mpp.common.header.ColumnHeader;
 import org.apache.iotdb.db.mpp.common.header.ColumnHeaderConstant;
 import org.apache.iotdb.db.mpp.common.header.DatasetHeader;
@@ -29,7 +27,7 @@ import org.apache.iotdb.db.mpp.common.header.DatasetHeaderFactory;
 import org.apache.iotdb.db.mpp.plan.execution.config.ConfigTaskResult;
 import org.apache.iotdb.db.mpp.plan.execution.config.IConfigTask;
 import org.apache.iotdb.db.mpp.plan.execution.config.executor.IConfigTaskExecutor;
-import org.apache.iotdb.db.mpp.plan.statement.metadata.GetTimeSlotListStatement;
+import org.apache.iotdb.db.mpp.plan.statement.metadata.CountTimeSlotListStatement;
 import org.apache.iotdb.rpc.TSStatusCode;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 import org.apache.iotdb.tsfile.read.common.block.TsBlockBuilder;
@@ -40,42 +38,32 @@ import com.google.common.util.concurrent.SettableFuture;
 import java.util.List;
 import java.util.stream.Collectors;
 
-public class GetTimeSlotListTask implements IConfigTask {
+public class CountTimeSlotListTask implements IConfigTask {
 
-  private final GetTimeSlotListStatement getTimeSlotListStatement;
+  private final CountTimeSlotListStatement countTimeSlotListStatement;
 
-  public GetTimeSlotListTask(GetTimeSlotListStatement getTimeSlotListStatement) {
-    this.getTimeSlotListStatement = getTimeSlotListStatement;
+  public CountTimeSlotListTask(CountTimeSlotListStatement countTimeSlotListStatement) {
+    this.countTimeSlotListStatement = countTimeSlotListStatement;
   }
 
   @Override
   public ListenableFuture<ConfigTaskResult> execute(IConfigTaskExecutor configTaskExecutor) {
     // If the action is executed successfully, return the Future.
     // If your operation is async, you can return the corresponding future directly.
-    return configTaskExecutor.getTimeSlotList(getTimeSlotListStatement);
-  }
-
-  public static void buildTsBlock(TsBlockBuilder builder, TTimePartitionSlot timePartitionSlot) {
-    builder.getTimeColumnBuilder().writeLong(0L);
-    builder
-        .getColumnBuilder(0)
-        .writeLong(
-            timePartitionSlot.getStartTime()
-                / IoTDBDescriptor.getInstance().getConfig().getTimePartitionInterval());
-    builder.declarePosition();
+    return configTaskExecutor.countTimeSlotList(countTimeSlotListStatement);
   }
 
   public static void buildTSBlock(
-      TGetTimeSlotListResp getTimeSlotListResp, SettableFuture<ConfigTaskResult> future) {
+      TCountTimeSlotListResp countTimeSlotListResp, SettableFuture<ConfigTaskResult> future) {
     List<TSDataType> outputDataTypes =
-        ColumnHeaderConstant.getTimeSlotListColumnHeaders.stream()
+        ColumnHeaderConstant.countTimeSlotListColumnHeaders.stream()
             .map(ColumnHeader::getColumnType)
             .collect(Collectors.toList());
     TsBlockBuilder builder = new TsBlockBuilder(outputDataTypes);
-
-    getTimeSlotListResp.getTimeSlotList().forEach(e -> buildTsBlock(builder, e));
-
-    DatasetHeader datasetHeader = DatasetHeaderFactory.getGetTimeSlotListHeader();
+    builder.getTimeColumnBuilder().writeLong(0L);
+    builder.getColumnBuilder(0).writeLong(countTimeSlotListResp.getCount());
+    builder.declarePosition();
+    DatasetHeader datasetHeader = DatasetHeaderFactory.getCountTimeSlotListHeader();
     future.set(new ConfigTaskResult(TSStatusCode.SUCCESS_STATUS, builder.build(), datasetHeader));
   }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/metadata/GetTimeSlotListTask.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/metadata/GetTimeSlotListTask.java
index 27d6381f4c..f07abe7025 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/metadata/GetTimeSlotListTask.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/metadata/GetTimeSlotListTask.java
@@ -30,9 +30,11 @@ import org.apache.iotdb.db.mpp.plan.execution.config.ConfigTaskResult;
 import org.apache.iotdb.db.mpp.plan.execution.config.IConfigTask;
 import org.apache.iotdb.db.mpp.plan.execution.config.executor.IConfigTaskExecutor;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.GetTimeSlotListStatement;
+import org.apache.iotdb.db.utils.DateTimeUtils;
 import org.apache.iotdb.rpc.TSStatusCode;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 import org.apache.iotdb.tsfile.read.common.block.TsBlockBuilder;
+import org.apache.iotdb.tsfile.utils.Binary;
 
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
@@ -55,13 +57,16 @@ public class GetTimeSlotListTask implements IConfigTask {
     return configTaskExecutor.getTimeSlotList(getTimeSlotListStatement);
   }
 
-  public static void buildTsBlock(TsBlockBuilder builder, TTimePartitionSlot timePartitionSlot) {
+  public static void buildTSBlockRow(TsBlockBuilder builder, TTimePartitionSlot timePartitionSlot) {
     builder.getTimeColumnBuilder().writeLong(0L);
     builder
         .getColumnBuilder(0)
         .writeLong(
             timePartitionSlot.getStartTime()
                 / IoTDBDescriptor.getInstance().getConfig().getTimePartitionInterval());
+    builder
+        .getColumnBuilder(1)
+        .writeBinary(new Binary(DateTimeUtils.convertLongToDate(timePartitionSlot.getStartTime())));
     builder.declarePosition();
   }
 
@@ -73,7 +78,7 @@ public class GetTimeSlotListTask implements IConfigTask {
             .collect(Collectors.toList());
     TsBlockBuilder builder = new TsBlockBuilder(outputDataTypes);
 
-    getTimeSlotListResp.getTimeSlotList().forEach(e -> buildTsBlock(builder, e));
+    getTimeSlotListResp.getTimeSlotList().forEach(e -> buildTSBlockRow(builder, e));
 
     DatasetHeader datasetHeader = DatasetHeaderFactory.getGetTimeSlotListHeader();
     future.set(new ConfigTaskResult(TSStatusCode.SUCCESS_STATUS, builder.build(), datasetHeader));
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/ASTVisitor.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/ASTVisitor.java
index 056c4c7893..9475f5ca5b 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/ASTVisitor.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/ASTVisitor.java
@@ -20,8 +20,6 @@
 package org.apache.iotdb.db.mpp.plan.parser;
 
 import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType;
-import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
-import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
 import org.apache.iotdb.common.rpc.thrift.TTimedQuota;
 import org.apache.iotdb.common.rpc.thrift.ThrottleType;
 import org.apache.iotdb.commons.auth.entity.PrivilegeType;
@@ -110,6 +108,7 @@ import org.apache.iotdb.db.mpp.plan.statement.metadata.CountDevicesStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CountLevelTimeSeriesStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CountNodesStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CountTimeSeriesStatement;
+import org.apache.iotdb.db.mpp.plan.statement.metadata.CountTimeSlotListStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CreateAlignedTimeSeriesStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CreateContinuousQueryStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CreateFunctionStatement;
@@ -760,7 +759,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
   private String parseAndValidateURI(IoTDBSqlParser.UriClauseContext ctx) {
     String uriString = parseStringLiteral(ctx.uri().getText());
     try {
-      URI uri = new URI(uriString);
+      new URI(uriString);
     } catch (URISyntaxException e) {
       throw new SemanticException(String.format("Invalid URI: %s", uriString));
     }
@@ -3404,50 +3403,78 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
   public Statement visitGetRegionId(IoTDBSqlParser.GetRegionIdContext ctx) {
     TConsensusGroupType type =
         ctx.DATA() == null ? TConsensusGroupType.SchemaRegion : TConsensusGroupType.DataRegion;
-    GetRegionIdStatement getRegionIdStatement = new GetRegionIdStatement(ctx.path.getText(), type);
-    if (ctx.seriesSlot != null) {
-      getRegionIdStatement.setSeriesSlotId(
-          new TSeriesPartitionSlot(Integer.parseInt(ctx.seriesSlot.getText())));
+    GetRegionIdStatement getRegionIdStatement = new GetRegionIdStatement(type);
+    if (ctx.database != null) {
+      getRegionIdStatement.setDatabase(ctx.database.getText());
     } else {
-      getRegionIdStatement.setDeviceId(ctx.deviceId.getText());
+      getRegionIdStatement.setDevice(ctx.device.getText());
     }
-    if (ctx.timeSlot != null) {
-      getRegionIdStatement.setTimeSlotId(
-          new TTimePartitionSlot(
-              Long.parseLong(ctx.timeSlot.getText()) * CONFIG.getTimePartitionInterval()));
-    } else if (ctx.timeStamp != null) {
-      getRegionIdStatement.setTimeStamp(Long.parseLong(ctx.timeStamp.getText()));
+    if (ctx.time != null) {
+      long timestamp = parseTimeValue(ctx.time, DateTimeUtils.currentTime());
+      if (timestamp < 0) {
+        throw new SemanticException("Please set the time >=0 or after 1970-01-01 00:00:00");
+      } else {
+        getRegionIdStatement.setTimeStamp(timestamp);
+      }
     }
     return getRegionIdStatement;
   }
 
   @Override
   public Statement visitGetSeriesSlotList(IoTDBSqlParser.GetSeriesSlotListContext ctx) {
-    GetSeriesSlotListStatement getSeriesSlotListStatement =
-        new GetSeriesSlotListStatement(ctx.prefixPath().getText());
-    if (ctx.DATA() != null) {
-      getSeriesSlotListStatement.setPartitionType(TConsensusGroupType.DataRegion);
-    } else if (ctx.SCHEMA() != null) {
-      getSeriesSlotListStatement.setPartitionType(TConsensusGroupType.SchemaRegion);
-    }
-    return getSeriesSlotListStatement;
+    TConsensusGroupType type =
+        ctx.DATA() == null ? TConsensusGroupType.SchemaRegion : TConsensusGroupType.DataRegion;
+    return new GetSeriesSlotListStatement(ctx.database.getText(), type);
   }
 
   @Override
   public Statement visitGetTimeSlotList(IoTDBSqlParser.GetTimeSlotListContext ctx) {
-    GetTimeSlotListStatement getTimeSlotListStatement =
-        new GetTimeSlotListStatement(
-            ctx.prefixPath().getText(),
-            new TSeriesPartitionSlot(Integer.parseInt(ctx.seriesSlot.getText())));
+    GetTimeSlotListStatement getTimeSlotListStatement = new GetTimeSlotListStatement();
+    if (ctx.database != null) {
+      getTimeSlotListStatement.setDatabase(ctx.database.getText());
+    } else if (ctx.device != null) {
+      getTimeSlotListStatement.setDevice(ctx.device.getText());
+    } else if (ctx.regionId != null) {
+      getTimeSlotListStatement.setRegionId(Integer.parseInt(ctx.regionId.getText()));
+    }
     if (ctx.startTime != null) {
-      getTimeSlotListStatement.setStartTime(Long.parseLong(ctx.startTime.getText()));
+      long timestamp = parseTimeValue(ctx.startTime, DateTimeUtils.currentTime());
+      if (timestamp < 0) {
+        throw new SemanticException("Please set the time >=0 or after 1970-01-01 00:00:00");
+      } else {
+        getTimeSlotListStatement.setStartTime(timestamp);
+      }
     }
     if (ctx.endTime != null) {
-      getTimeSlotListStatement.setEndTime(Long.parseLong(ctx.endTime.getText()));
+      long timestamp = parseTimeValue(ctx.endTime, DateTimeUtils.currentTime());
+      if (timestamp < 0) {
+        throw new SemanticException("Please set the time >=0 or after 1970-01-01 00:00:00");
+      } else {
+        getTimeSlotListStatement.setEndTime(timestamp);
+      }
     }
     return getTimeSlotListStatement;
   }
 
+  @Override
+  public Statement visitCountTimeSlotList(IoTDBSqlParser.CountTimeSlotListContext ctx) {
+    CountTimeSlotListStatement countTimeSlotListStatement = new CountTimeSlotListStatement();
+    if (ctx.database != null) {
+      countTimeSlotListStatement.setDatabase(ctx.database.getText());
+    } else if (ctx.device != null) {
+      countTimeSlotListStatement.setDevice(ctx.device.getText());
+    } else if (ctx.regionId != null) {
+      countTimeSlotListStatement.setRegionId(Integer.parseInt(ctx.regionId.getText()));
+    }
+    if (ctx.startTime != null) {
+      countTimeSlotListStatement.setStartTime(Long.parseLong(ctx.startTime.getText()));
+    }
+    if (ctx.endTime != null) {
+      countTimeSlotListStatement.setEndTime(Long.parseLong(ctx.endTime.getText()));
+    }
+    return countTimeSlotListStatement;
+  }
+
   @Override
   public Statement visitMigrateRegion(IoTDBSqlParser.MigrateRegionContext ctx) {
     return new MigrateRegionStatement(
@@ -3704,9 +3731,8 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
       throw new SemanticException("Limit configuration is not enabled, please enable it first.");
     }
     ShowSpaceQuotaStatement showSpaceQuotaStatement = new ShowSpaceQuotaStatement();
-    List<PartialPath> databases = null;
     if (ctx.prefixPath() != null) {
-      databases = new ArrayList<>();
+      List<PartialPath> databases = new ArrayList<>();
       for (IoTDBSqlParser.PrefixPathContext prefixPathContext : ctx.prefixPath()) {
         databases.add(parsePrefixPath(prefixPathContext));
       }
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/StatementVisitor.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/StatementVisitor.java
index 5e4673ed7c..8a5bcf18ab 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/StatementVisitor.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/StatementVisitor.java
@@ -38,6 +38,7 @@ import org.apache.iotdb.db.mpp.plan.statement.metadata.CountDevicesStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CountLevelTimeSeriesStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CountNodesStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CountTimeSeriesStatement;
+import org.apache.iotdb.db.mpp.plan.statement.metadata.CountTimeSlotListStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CreateAlignedTimeSeriesStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CreateContinuousQueryStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.CreateFunctionStatement;
@@ -489,6 +490,11 @@ public abstract class StatementVisitor<R, C> {
     return visitStatement(getTimeSlotListStatement, context);
   }
 
+  public R visitCountTimeSlotList(
+      CountTimeSlotListStatement countTimeSlotListStatement, C context) {
+    return visitStatement(countTimeSlotListStatement, context);
+  }
+
   public R visitMigrateRegion(MigrateRegionStatement migrateRegionStatement, C context) {
     return visitStatement(migrateRegionStatement, context);
   }
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/GetTimeSlotListStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CountTimeSlotListStatement.java
similarity index 66%
copy from server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/GetTimeSlotListStatement.java
copy to server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CountTimeSlotListStatement.java
index 25a3a26f39..39c279a239 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/GetTimeSlotListStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CountTimeSlotListStatement.java
@@ -19,7 +19,6 @@
 
 package org.apache.iotdb.db.mpp.plan.statement.metadata;
 
-import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
 import org.apache.iotdb.commons.exception.IllegalPathException;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
@@ -27,41 +26,37 @@ import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
-/**
- * GET REGION statement
- *
- * <p>Here is the syntax definition:
- *
- * <p>SHOW TIMESLOTID OF path=prefixPath WHERE SERIESSLOTID operator_eq seriesSlot=INTEGER_LITERAL
- * (OPERATOR_AND STARTTIME operator_eq startTime=INTEGER_LITERAL)? (OPERATOR_AND ENDTIME operator_eq
- * endTime=INTEGER_LITERAL)?
- */
-public class GetTimeSlotListStatement extends Statement implements IConfigStatement {
+public class CountTimeSlotListStatement extends Statement implements IConfigStatement {
 
-  private final String storageGroup;
+  private String database;
 
-  private final TSeriesPartitionSlot seriesSlotId;
+  private String device;
+
+  private long regionId = -1;
 
   private long startTime = -1;
 
   private long endTime = -1;
 
-  public GetTimeSlotListStatement(String storageGroup, TSeriesPartitionSlot seriesSlotId) {
+  private static final Logger LOGGER = LoggerFactory.getLogger(CountTimeSlotListStatement.class);
+
+  public CountTimeSlotListStatement() {
     super();
-    this.storageGroup = storageGroup;
-    this.seriesSlotId = seriesSlotId;
   }
 
-  public String getStorageGroup() {
-    return storageGroup;
+  public void setDatabase(String database) {
+    this.database = database;
   }
 
-  public TSeriesPartitionSlot getSeriesSlotId() {
-    return seriesSlotId;
+  public String getDatabase() {
+    return database;
   }
 
   public long getStartTime() {
@@ -80,9 +75,25 @@ public class GetTimeSlotListStatement extends Statement implements IConfigStatem
     this.endTime = endTime;
   }
 
+  public void setDevice(String device) {
+    this.device = device;
+  }
+
+  public String getDevice() {
+    return this.device;
+  }
+
+  public void setRegionId(long regionId) {
+    this.regionId = regionId;
+  }
+
+  public long getRegionId() {
+    return this.regionId;
+  }
+
   @Override
   public <R, C> R accept(StatementVisitor<R, C> visitor, C context) {
-    return visitor.visitGetTimeSlotList(this, context);
+    return visitor.visitCountTimeSlotList(this, context);
   }
 
   @Override
@@ -92,9 +103,13 @@ public class GetTimeSlotListStatement extends Statement implements IConfigStatem
 
   @Override
   public List<PartialPath> getPaths() {
+    if (database == null) {
+      return new ArrayList<>();
+    }
     try {
-      return Collections.singletonList(new PartialPath(storageGroup));
+      return Collections.singletonList(new PartialPath(database));
     } catch (IllegalPathException e) {
+      LOGGER.warn("illegal path: {}", database);
       return new ArrayList<>();
     }
   }
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/GetRegionIdStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/GetRegionIdStatement.java
index c4fbcfb374..d2e94d488f 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/GetRegionIdStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/GetRegionIdStatement.java
@@ -20,8 +20,6 @@
 package org.apache.iotdb.db.mpp.plan.statement.metadata;
 
 import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType;
-import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
-import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
 import org.apache.iotdb.commons.exception.IllegalPathException;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
@@ -29,6 +27,9 @@ import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -44,58 +45,41 @@ import java.util.List;
  */
 public class GetRegionIdStatement extends Statement implements IConfigStatement {
 
-  private final String storageGroup;
-
-  private String deviceId;
-
-  private TSeriesPartitionSlot seriesSlotId;
+  private String database;
 
+  private String device;
   private final TConsensusGroupType partitionType;
-
-  private TTimePartitionSlot timeSlotId;
-
   private long timeStamp = -1;
 
-  public GetRegionIdStatement(String storageGroup, TConsensusGroupType partitionType) {
+  private static final Logger LOGGER = LoggerFactory.getLogger(GetRegionIdStatement.class);
+
+  public GetRegionIdStatement(TConsensusGroupType partitionType) {
     super();
-    this.storageGroup = storageGroup;
     this.partitionType = partitionType;
   }
 
-  public String getStorageGroup() {
-    return storageGroup;
+  public String getDatabase() {
+    return database;
   }
 
   public TConsensusGroupType getPartitionType() {
     return partitionType;
   }
 
-  public TSeriesPartitionSlot getSeriesSlotId() {
-    return seriesSlotId;
-  }
-
-  public String getDeviceId() {
-    return deviceId;
-  }
-
-  public TTimePartitionSlot getTimeSlotId() {
-    return timeSlotId;
+  public String getDevice() {
+    return device;
   }
 
   public long getTimeStamp() {
     return timeStamp;
   }
 
-  public void setTimeSlotId(TTimePartitionSlot timeSlotId) {
-    this.timeSlotId = timeSlotId;
+  public void setDatabase(String database) {
+    this.database = database;
   }
 
-  public void setSeriesSlotId(TSeriesPartitionSlot seriesSlotId) {
-    this.seriesSlotId = seriesSlotId;
-  }
-
-  public void setDeviceId(String deviceId) {
-    this.deviceId = deviceId;
+  public void setDevice(String device) {
+    this.device = device;
   }
 
   public void setTimeStamp(long timeStamp) {
@@ -114,9 +98,13 @@ public class GetRegionIdStatement extends Statement implements IConfigStatement
 
   @Override
   public List<PartialPath> getPaths() {
+    if (database == null) {
+      return new ArrayList<>();
+    }
     try {
-      return Collections.singletonList(new PartialPath(storageGroup));
+      return Collections.singletonList(new PartialPath(database));
     } catch (IllegalPathException e) {
+      LOGGER.warn("illegal path: {}", database);
       return new ArrayList<>();
     }
   }
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/GetSeriesSlotListStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/GetSeriesSlotListStatement.java
index 3220714849..ff5ad73a18 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/GetSeriesSlotListStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/GetSeriesSlotListStatement.java
@@ -40,27 +40,23 @@ import java.util.List;
  */
 public class GetSeriesSlotListStatement extends Statement implements IConfigStatement {
 
-  private final String storageGroup;
+  private final String database;
+  private final TConsensusGroupType partitionType;
 
-  private TConsensusGroupType partitionType;
-
-  public GetSeriesSlotListStatement(String storageGroup) {
+  public GetSeriesSlotListStatement(String database, TConsensusGroupType partitionType) {
     super();
-    this.storageGroup = storageGroup;
+    this.database = database;
+    this.partitionType = partitionType;
   }
 
-  public String getStorageGroup() {
-    return storageGroup;
+  public String getDatabase() {
+    return database;
   }
 
   public TConsensusGroupType getPartitionType() {
     return partitionType;
   }
 
-  public void setPartitionType(TConsensusGroupType partitionType) {
-    this.partitionType = partitionType;
-  }
-
   @Override
   public <R, C> R accept(StatementVisitor<R, C> visitor, C context) {
     return visitor.visitGetSeriesSlotList(this, context);
@@ -74,7 +70,7 @@ public class GetSeriesSlotListStatement extends Statement implements IConfigStat
   @Override
   public List<PartialPath> getPaths() {
     try {
-      return Collections.singletonList(new PartialPath(storageGroup));
+      return Collections.singletonList(new PartialPath(database));
     } catch (IllegalPathException e) {
       return new ArrayList<>();
     }
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/GetTimeSlotListStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/GetTimeSlotListStatement.java
index 25a3a26f39..2737d1c364 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/GetTimeSlotListStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/GetTimeSlotListStatement.java
@@ -19,7 +19,6 @@
 
 package org.apache.iotdb.db.mpp.plan.statement.metadata;
 
-import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
 import org.apache.iotdb.commons.exception.IllegalPathException;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
@@ -27,6 +26,9 @@ import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -42,26 +44,28 @@ import java.util.List;
  */
 public class GetTimeSlotListStatement extends Statement implements IConfigStatement {
 
-  private final String storageGroup;
+  private String database;
+
+  private String device;
 
-  private final TSeriesPartitionSlot seriesSlotId;
+  private long regionId = -1;
 
   private long startTime = -1;
 
   private long endTime = -1;
 
-  public GetTimeSlotListStatement(String storageGroup, TSeriesPartitionSlot seriesSlotId) {
+  private static final Logger LOGGER = LoggerFactory.getLogger(GetTimeSlotListStatement.class);
+
+  public GetTimeSlotListStatement() {
     super();
-    this.storageGroup = storageGroup;
-    this.seriesSlotId = seriesSlotId;
   }
 
-  public String getStorageGroup() {
-    return storageGroup;
+  public void setDatabase(String database) {
+    this.database = database;
   }
 
-  public TSeriesPartitionSlot getSeriesSlotId() {
-    return seriesSlotId;
+  public String getDatabase() {
+    return database;
   }
 
   public long getStartTime() {
@@ -80,6 +84,22 @@ public class GetTimeSlotListStatement extends Statement implements IConfigStatem
     this.endTime = endTime;
   }
 
+  public void setDevice(String device) {
+    this.device = device;
+  }
+
+  public String getDevice() {
+    return this.device;
+  }
+
+  public void setRegionId(long regionId) {
+    this.regionId = regionId;
+  }
+
+  public long getRegionId() {
+    return this.regionId;
+  }
+
   @Override
   public <R, C> R accept(StatementVisitor<R, C> visitor, C context) {
     return visitor.visitGetTimeSlotList(this, context);
@@ -92,9 +112,13 @@ public class GetTimeSlotListStatement extends Statement implements IConfigStatem
 
   @Override
   public List<PartialPath> getPaths() {
+    if (database == null) {
+      return new ArrayList<>();
+    }
     try {
-      return Collections.singletonList(new PartialPath(storageGroup));
+      return Collections.singletonList(new PartialPath(database));
     } catch (IllegalPathException e) {
+      LOGGER.warn("illegal path: {}", database);
       return new ArrayList<>();
     }
   }
diff --git a/thrift-confignode/src/main/thrift/confignode.thrift b/thrift-confignode/src/main/thrift/confignode.thrift
index 0a2d0fb57a..38afe6ef41 100644
--- a/thrift-confignode/src/main/thrift/confignode.thrift
+++ b/thrift-confignode/src/main/thrift/confignode.thrift
@@ -232,12 +232,10 @@ struct TDataPartitionTableResp {
 }
 
 struct TGetRegionIdReq {
-    1: required string database
-    2: required common.TConsensusGroupType type
-    3: optional common.TSeriesPartitionSlot seriesSlotId
-    4: optional string deviceId
-    5: optional common.TTimePartitionSlot timeSlotId
-    6: optional i64 timeStamp
+    1: required common.TConsensusGroupType type
+    2: optional string database
+    3: optional string device
+    4: optional i64 timeStamp
 }
 
 struct TGetRegionIdResp {
@@ -246,10 +244,11 @@ struct TGetRegionIdResp {
 }
 
 struct TGetTimeSlotListReq {
-    1: required string database
-    2: required common.TSeriesPartitionSlot seriesSlotId
-    3: optional i64 startTime
-    4: optional i64 endTime
+    1: optional string database
+    3: optional string device
+    4: optional i64 regionId
+    5: optional i64 startTime
+    6: optional i64 endTime
 }
 
 struct TGetTimeSlotListResp {
@@ -257,9 +256,22 @@ struct TGetTimeSlotListResp {
     2: optional list<common.TTimePartitionSlot> timeSlotList
 }
 
+struct TCountTimeSlotListReq {
+    1: optional string database
+    3: optional string device
+    4: optional i64 regionId
+    5: optional i64 startTime
+    6: optional i64 endTime
+}
+
+struct TCountTimeSlotListResp {
+    1: required common.TSStatus status
+    2: optional i64 count
+}
+
 struct TGetSeriesSlotListReq {
     1: required string database
-    2: optional common.TConsensusGroupType type
+    2: required common.TConsensusGroupType type
 }
 
 struct TGetSeriesSlotListResp {
@@ -1292,6 +1304,8 @@ service IConfigNodeRPCService {
   /** Get a specific SeriesSlot's TimeSlots by start time and end time */
   TGetTimeSlotListResp getTimeSlotList(TGetTimeSlotListReq req)
 
+  TCountTimeSlotListResp countTimeSlotList(TCountTimeSlotListReq req)
+
   /** Get the given database's assigned SeriesSlots */
   TGetSeriesSlotListResp getSeriesSlotList(TGetSeriesSlotListReq req)