This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new c60eb7740c5 [improvement](statistics)Use key column id to query column
statistic table. (#28885) (#29293)
c60eb7740c5 is described below
commit c60eb7740c544e5f881669f53eab6f43d1185d2b
Author: Jibing-Li <[email protected]>
AuthorDate: Fri Dec 29 17:05:11 2023 +0800
[improvement](statistics)Use key column id to query column statistic table.
(#28885) (#29293)
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 8cbb9df2371..dc4f89c1e4d 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
@@ -99,10 +99,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}"
@@ -359,12 +355,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]