diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/GlobalVariable.java b/fe/fe-core/src/main/java/org/apache/doris/qe/GlobalVariable.java index 91f1eb6b74863a..4b91c907bfb0e0 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/GlobalVariable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/GlobalVariable.java @@ -34,7 +34,8 @@ public final class GlobalVariable { public static final int VARIABLE_VERSION_0 = 0; public static final int VARIABLE_VERSION_100 = 100; - public static final int CURRENT_VARIABLE_VERSION = VARIABLE_VERSION_100; + public static final int VARIABLE_VERSION_101 = 101; + public static final int CURRENT_VARIABLE_VERSION = VARIABLE_VERSION_101; public static final String VARIABLE_VERSION = "variable_version"; public static final String VERSION_COMMENT = "version_comment"; diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java index 5368112bf1cec7..79d8e7fb13ae01 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java @@ -1776,7 +1776,7 @@ public void setEnableLeftZigZag(boolean enableLeftZigZag) { "Maximum table width to enable auto analyze, " + "table with more columns than this value will not be auto analyzed."}, flag = VariableMgr.GLOBAL) - public int autoAnalyzeTableWidthThreshold = 100; + public int autoAnalyzeTableWidthThreshold = 300; @VariableMgr.VarAttr(name = AUTO_ANALYZE_START_TIME, needForward = true, checker = "checkAnalyzeTimeFormat", description = {"该参数定义自动ANALYZE例程的开始时间", @@ -1841,7 +1841,7 @@ public void setEnableLeftZigZag(boolean enableLeftZigZag) { + "exceeds (100 - table_stats_health_threshold)% since the last " + "statistics collection operation, the statistics for this table are" + "considered outdated."}) - public int tableStatsHealthThreshold = 60; + public int tableStatsHealthThreshold = 90; @VariableMgr.VarAttr(name = ENABLE_MATERIALIZED_VIEW_REWRITE, needForward = true, description = {"是否开启基于结构信息的物化视图透明改写", diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java index 31f3ab127468f9..f10760f1ec386c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java @@ -34,6 +34,8 @@ import org.apache.doris.common.util.SerializationUtils; import org.apache.doris.nereids.trees.expressions.literal.Literal; import org.apache.doris.persist.GlobalVarPersistInfo; +import org.apache.doris.statistics.StatisticConstants; +import org.apache.doris.statistics.util.StatisticsUtil; import com.google.common.base.Preconditions; import com.google.common.base.Strings; @@ -980,6 +982,20 @@ public static void forceUpdateVariables() { SessionVariable.ENABLE_PIPELINE_X_ENGINE, String.valueOf(true)); } + if (currentVariableVersion < GlobalVariable.VARIABLE_VERSION_101) { + if (StatisticsUtil.getAutoAnalyzeTableWidthThreshold() + < StatisticConstants.AUTO_ANALYZE_TABLE_WIDTH_THRESHOLD) { + VariableMgr.refreshDefaultSessionVariables("update variable version", + SessionVariable.AUTO_ANALYZE_TABLE_WIDTH_THRESHOLD, + String.valueOf(StatisticConstants.AUTO_ANALYZE_TABLE_WIDTH_THRESHOLD)); + } + if (StatisticsUtil.getTableStatsHealthThreshold() + < StatisticConstants.TABLE_STATS_HEALTH_THRESHOLD) { + VariableMgr.refreshDefaultSessionVariables("update variable version", + SessionVariable.TABLE_STATS_HEALTH_THRESHOLD, + String.valueOf(StatisticConstants.TABLE_STATS_HEALTH_THRESHOLD)); + } + } if (currentVariableVersion < GlobalVariable.CURRENT_VARIABLE_VERSION) { VariableMgr.refreshDefaultSessionVariables("update variable version", GlobalVariable.VARIABLE_VERSION, diff --git a/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticConstants.java b/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticConstants.java index b0009a76d64cd6..cc1508217fb111 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticConstants.java +++ b/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticConstants.java @@ -89,13 +89,13 @@ public class StatisticConstants { public static final long EXTERNAL_TABLE_AUTO_ANALYZE_INTERVAL_IN_MILLIS = TimeUnit.HOURS.toMillis(24); - public static final int TABLE_STATS_HEALTH_THRESHOLD = 60; + public static final int TABLE_STATS_HEALTH_THRESHOLD = 90; public static final int ANALYZE_TIMEOUT_IN_SEC = 43200; public static final int TASK_QUEUE_CAP = 10; - public static final int AUTO_ANALYZE_TABLE_WIDTH_THRESHOLD = 100; + public static final int AUTO_ANALYZE_TABLE_WIDTH_THRESHOLD = 300; public static final int MSG_LEN_UPPER_BOUND = 1024;