Skip to content

Commit

Permalink
[statistic](cloud) Add session variable force_sample_analyze, default…
Browse files Browse the repository at this point in the history
… false (#32117)
  • Loading branch information
gavinchou authored Mar 29, 2024
1 parent 5c934e7 commit 37ea92d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ public class SessionVariable implements Serializable, Writable {

public static final String ENABLE_AUTO_ANALYZE = "enable_auto_analyze";

public static final String FORCE_SAMPLE_ANALYZE = "force_sample_analyze";

public static final String AUTO_ANALYZE_TABLE_WIDTH_THRESHOLD = "auto_analyze_table_width_threshold";

public static final String FASTER_FLOAT_CONVERT = "faster_float_convert";
Expand Down Expand Up @@ -1511,6 +1513,11 @@ public void setEnableLeftZigZag(boolean enableLeftZigZag) {
flag = VariableMgr.GLOBAL)
public boolean enableAutoAnalyze = true;

@VariableMgr.VarAttr(name = FORCE_SAMPLE_ANALYZE,
description = {"是否将 full analyze 自动转换成 sample analyze", "Set true to force sample analyze"},
flag = VariableMgr.GLOBAL)
public boolean forceSampleAnalyze = Config.force_sample_analyze;

@VariableMgr.VarAttr(name = AUTO_ANALYZE_TABLE_WIDTH_THRESHOLD,
description = {"参与自动收集的最大表宽度,列数多于这个参数的表不参与自动收集",
"Maximum table width to enable auto analyze, "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void createAnalyze(AnalyzeStmt analyzeStmt, boolean proxy) throws DdlExce
if (!StatisticsUtil.statsTblAvailable() && !FeConstants.runningUnitTest) {
throw new DdlException("Stats table not available, please make sure your cluster status is normal");
}
if (Config.force_sample_analyze) {
if (ConnectContext.get().getSessionVariable().forceSampleAnalyze) {
analyzeStmt.checkAndSetSample();
}
if (analyzeStmt instanceof AnalyzeDBStmt) {
Expand Down

0 comments on commit 37ea92d

Please sign in to comment.