This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 578a7dadc11 [improvement](statistics)Use key column id to query column
statistic table. (#28885)
578a7dadc11 is described below
commit 578a7dadc11db1e5b9dc64fdeb603a1dbda73ef6
Author: Jibing-Li <[email protected]>
AuthorDate: Wed Dec 27 14:38:55 2023 +0800
[improvement](statistics)Use key column id to query column statistic table.
(#28885)
Use id as where predicate to load column statistic cache. This could
improve performance, because id is the first order key in column statistics
table.
---
.../org/apache/doris/statistics/StatisticsRepository.java | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsRepository.java
b/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsRepository.java
index 76e286e55f7..0ffc818b1a0 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsRepository.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsRepository.java
@@ -97,10 +97,6 @@ public class StatisticsRepository {
+ " WHERE tbl_id = ${tblId}"
+ " AND part_id IS NOT NULL";
- private static final String QUERY_COLUMN_STATISTICS = "SELECT * FROM " +
FeConstants.INTERNAL_DB_NAME
- + "." + StatisticConstants.STATISTIC_TBL_NAME + " WHERE "
- + "tbl_id=${tblId} AND idx_id=${idxId} AND col_id='${colId}'";
-
private static final String QUERY_PARTITION_STATISTICS = "SELECT * FROM "
+ FeConstants.INTERNAL_DB_NAME
+ "." + StatisticConstants.STATISTIC_TBL_NAME + " WHERE "
+ " ${inPredicate}"
@@ -357,12 +353,11 @@ public class StatisticsRepository {
public static List<ResultRow> loadColStats(long tableId, long idxId,
String colName) {
Map<String, String> params = new HashMap<>();
- params.put("tblId", String.valueOf(tableId));
- params.put("idxId", String.valueOf(idxId));
- params.put("colId", StatisticsUtil.escapeSQL(colName));
+ String id = constructId(tableId, idxId, colName);
+ params.put("id", StatisticsUtil.escapeSQL(id));
return StatisticsUtil.execStatisticQuery(new StringSubstitutor(params)
- .replace(QUERY_COLUMN_STATISTICS));
+ .replace(FETCH_COLUMN_STATISTIC_TEMPLATE));
}
public static List<ResultRow> loadPartStats(Collection<StatisticsCacheKey>
keys) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]