System variables
StarRocks provides many system variables that can be set and modified to suit your requirements. This section describes the variables supported by StarRocks. You can view the settings of these variables by running the SHOW VARIABLES command on your MySQL client. You can also use the SET command to dynamically set or modify variables. You can make these variables take effect globally on the entire system, only in the current session, or only in a single query statement.
The variables in StarRocks refer to the variable sets in MySQL, but some variables are only compatible with the MySQL client protocol and do not function on the MySQL database.
NOTE
Any user has the privilege to run SHOW VARIABLES and make a variable take effect at session level. However, only users with the SYSTEM-level OPERATE privilege can make a variable take effect globally. Globally effective variables take effect on all the future sessions (excluding the current session).
If you want to make a setting change for the current session and also make that setting change apply to all future sessions, you can make the change twice, once without the
GLOBALmodifier and once with it. For example:SET query_mem_limit = 137438953472; -- Apply to the current session.
SET GLOBAL query_mem_limit = 137438953472; -- Apply to all future sessions.
Variable hierarchy and typesβ
StarRocks supports three types (levels) of variables: global variables, session variables, and SET_VAR hints. Their hierarchical relationship is as follows:
- Global variables take effect on global level, and can be overridden by session variables and
SET_VARhints. - Session variables take effect only on the current session, and can be overridden by
SET_VARhints. SET_VARhints take effect only on the current query statement.
View variablesβ
You can view all or some variables by using SHOW VARIABLES [LIKE 'xxx']. Example:
-- Show all variables in the system.
SHOW VARIABLES;
-- Show variables that match a certain pattern.
SHOW VARIABLES LIKE '%time_zone%';
Set variablesβ
Set variables globally or for a single sessionβ
You can set variables to take effect globally or only on the current session. When set to global, the new value will be used for all the future sessions, while the current session still uses the original value. When set to "current session only", the variable will only take effect on the current session.
A variable set by SET <var_name> = xxx; only takes effect for the current session. Example:
SET query_mem_limit = 137438953472;
SET forward_to_master = true;
SET time_zone = "Asia/Shanghai";
A variable set by SET GLOBAL <var_name> = xxx; takes effect globally. Example:
SET GLOBAL query_mem_limit = 137438953472;
The following variables only take effect globally. They cannot take effect for a single session, which means you must use SET GLOBAL <var_name> = xxx; for these variables. If you try to set such a variable for a single session (SET <var_name> = xxx;), an error is returned.
- activate_all_roles_on_login
- character_set_database
- default_rowset_type
- enable_reduce_cast_varchar_expr_sync_type
- enable_reduce_cast_varchar_length_inheritance
- enable_query_queue_select
- enable_query_queue_statistic
- enable_query_queue_load
- init_connect
- lower_case_table_names
- license
- language
- query_cache_size
- query_queue_fresh_resource_usage_interval_ms
- query_queue_concurrency_limit
- query_queue_mem_used_pct_limit
- query_queue_cpu_used_permille_limit
- query_queue_pending_timeout_second
- query_queue_max_queued_queries
- system_time_zone
- version_comment
- version
In addition, variable settings also support constant expressions, such as:
SET query_mem_limit = 10 * 1024 * 1024 * 1024;
SET forward_to_master = concat('tr', 'u', 'e');
Set variables in a single query statementβ
In some scenarios, you may need to set variables specifically for certain queries. By using the SET_VAR hint, you can set session variables that will take effect only within a single statement.
StarRocks supports using SET_VAR in the following statements;
- SELECT
- INSERT (from v3.1.12 and v3.2.0 onwards)
- UPDATE (from v3.1.12 and v3.2.0 onwards)
- DELETE (from v3.1.12 and v3.2.0 onwards)
SET_VAR can only be placed after the above keywords and enclosed in /*+...*/.
Example:
SELECT /*+ SET_VAR(query_mem_limit = 8589934592) */ name FROM people ORDER BY name;
SELECT /*+ SET_VAR(query_timeout = 1) */ sleep(3);
UPDATE /*+ SET_VAR(insert_timeout=100) */ tbl SET c1 = 2 WHERE c1 = 1;
DELETE /*+ SET_VAR(query_mem_limit = 8589934592) */
FROM my_table PARTITION p1
WHERE k1 = 3;
INSERT /*+ SET_VAR(insert_timeout = 10000000) */
INTO insert_wiki_edit
SELECT * FROM FILES(
"path" = "s3://inserttest/parquet/insert_wiki_edit_append.parquet",
"format" = "parquet",
"aws.s3.access_key" = "XXXXXXXXXX",
"aws.s3.secret_key" = "YYYYYYYYYY",
"aws.s3.region" = "us-west-2"
);
You can also set multiple variables in a single statement. Example:
SELECT /*+ SET_VAR
(
exec_mem_limit = 515396075520,
query_timeout=10000000,
batch_size=4096,
parallel_fragment_exec_instance_num=32
)
*/ * FROM TABLE;
Set variables as user propertiesβ
You can set session variables as user properties using the ALTER USER. This feature is supported from v3.3.3.
Example:
-- Set the session variable `query_timeout` to `600` for the user jack.
ALTER USER 'jack' SET PROPERTIES ('session.query_timeout' = '600');
Descriptions of variablesβ
The variables are described in alphabetical order. Variables with the global label can only take effect globally. Other variables can take effect either globally or for a single session.
activate_all_roles_on_login (global)β
- Description: Whether to enable all roles (including default roles and granted roles) for a StarRocks user when the user connects to the StarRocks cluster.
- If enabled (
true), all roles of the user are activated at user login. This takes precedence over the roles set by SET DEFAULT ROLE. - If disabled (
false), the roles set by SET DEFAULT ROLE are activated.
- If enabled (
- Default: false
- Introduced in: v3.0
If you want to activate the roles assigned to you in a session, use the SET ROLE command.
auto_increment_incrementβ
Used for MySQL client compatibility. No practical usage.
autocommitβ
Used for MySQL client compatibility. No practical usage.
chunk_sizeβ
- Description: Used to specify the number of rows of a single packet transmitted by each node during query execution. The default is 4096, i.e., every 4096 rows of data generated by the source node is packaged and sent to the destination node. A larger number of rows will improve the query throughput in large data volume scenarios, but may increase the query latency in small data volume scenarios. Also, it may increase the memory overhead of the query. We recommend to set
batch_sizebetween 1024 to 4096. - Default: 4096
big_query_profile_thresholdβ
-
Description: Used to set the threshold for big queries. When the session variable
enable_profileis set tofalseand the amount of time taken by a query exceeds the threshold specified by the variablebig_query_profile_threshold, a profile is generated for that query.Note: In versions v3.1.5 to v3.1.7, as well as v3.2.0 to v3.2.2, we introduced the
big_query_profile_second_thresholdfor setting the threshold for big queries. In versions v3.1.8, v3.2.3, and subsequent releases, this parameter has been replaced bybig_query_profile_thresholdto offer more flexible configuration options. -
Default: 0
-
Unit: Second
-
Data type: String
-
Introduced in: v3.1
catalogβ
- Description: Used to specify the catalog to which the session belongs.
- Default: default_catalog
- Data type: String
- Introduced in: v3.2.4
cbo_decimal_cast_string_strictβ
- Description: Controls how the CBO converts data from the DECIMAL type to the STRING type. If this variable is set to
true, the logic built in v2.5.x and later versions prevails and the system implements strict conversion (namely, the system truncates the generated string and fills 0s based on the scale length). If this variable is set tofalse, the logic built in versions earlier than v2.5.x prevails and the system processes all valid digits to generate a string. - Default: true
- Introduced in: v2.5.14
cbo_enable_low_cardinality_optimizeβ
- Description: Whether to enable low cardinality optimization. After this feature is enabled, the performance of querying STRING columns improves by about three times.
- Default: true
cbo_eq_base_typeβ
- Description: Specifies the data type used for data comparison between DECIMAL data and STRING data. The default value is
DECIMAL, and VARCHAR is also a valid value. This variable takes effect only for=and!=comparison. - Data type: String
- Introduced in: v2.5.14
cbo_json_v2_dict_optβ
- Description: Whether to enable low-cardinality dictionary optimization for Flat JSON (JSON v2) extended string subcolumns created by JSON path rewrite. When enabled, the optimizer may build and use global dictionaries for those subcolumns to accelerate string expressions, GROUP BY, and JOIN operations.
- Default: true
- Data type: Boolean
cbo_json_v2_rewriteβ
- Description: Whether to enable JSON v2 path rewrite in the optimizer. When enabled, JSON functions (such as
get_json_*) can be rewritten to direct access of Flat JSON subcolumns, enabling predicate pushdown, column pruning, and dictionary optimization. - Default: true
- Data type: Boolean
cbo_materialized_view_rewrite_related_mvs_limitβ
- Description: Specifies the maximum number of candidate materialized views allowed during query planning.
- Default: 64
- Introduced in: v3.1.9, v3.2.5
cbo_prune_subfieldβ
- Description: Whether to enable JSON subfield pruning. This variable must be used with the BE dynamic parameter
enable_json_flat. Otherwise, it may degrade JSON data query performance. - Default: false
- Data type: Int
- Introduced in: v3.3.0
custom_query_id (session)β
- Description: Used to bind some external identifier to a current query. Can be set using
SET SESSION custom_query_id = 'my-query-id';before executing a query. The value is reset after query is finished. This value can be passed toKILL QUERY 'my-query-id'. Value can be found in audit logs as acustomQueryIdfield. - Default: ""
- Data type: String
- Introduced in: v3.4.0
enable_sync_materialized_view_rewriteβ
- Description: Whether to enable query rewrite based on synchronous materialized views.
- Default: true
- Introduced in: v3.1.11, v3.2.5
query_including_mv_namesβ
- Description: Specifies the name of the asynchronous materialized views to include in query execution. You can use this variable to limit the number of candidate materialized views and improve the query rewrite performance in the optimizer. This item takes effect prior to
query_excluding_mv_names. - Default: empty
- Data type: String
- Introduced in: v3.1.11, v3.2.5
query_excluding_mv_namesβ
- Description: Specifies the name of the asynchronous materialized views to exclude from query execution. You can use this variable to limit the number of candidate materialized views and reduce the time of query rewrite in the optimizer.
query_including_mv_namestakes effect prior to this item. - Default: empty
- Data type: String
- Introduced in: v3.1.11, v3.2.5
optimizer_materialized_view_timelimitβ
- Description: Specifies the maximum time that one materialized view rewrite rule can consume. When the threshold is reached, this rule will not be used for query rewrite.
- Default: 1000
- Unit: ms
- Introduced in: v3.1.9, v3.2.5
enable_materialized_view_agg_pushdown_rewriteβ
- Description: Whether to enable aggregation pushdown for materialized view query rewrite. If it is set to
true, aggregate functions will be pushed down to Scan Operator during query execution and rewritten by the materialized view before the Join Operator is executed. This will relieve the data expansion caused by Join and thereby improve the query performance. For detailed information about the scenarios and limitations of this feature, see Aggregation pushdown. - Default: false
- Introduced in: v3.3.0
enable_materialized_view_text_match_rewriteβ
- Description: Whether to enable text-based materialized view rewrite. When this item is set to true, the optimizer will compare the query with the existing materialized views. A query will be rewritten if the abstract syntax tree of the materialized view's definition matches that of the query or its sub-query.
- Default: true
- Introduced in: v3.2.5, v3.3.0
materialized_view_subuqery_text_match_max_countβ
- Description: Specifies the maximum number of times that the system checks whether a query's sub-query matches the materialized views' definition.
- Default: 4
- Introduced in: v3.2.5, v3.3.0
enable_force_rule_based_mv_rewriteβ
- Description: Whether to enable query rewrite for queries against multiple tables in the optimizer's rule-based optimization phase. Enabling this feature will improve the robustness of the query rewrite. However, it will also increase the time consumption if the query misses the materialized view.
- Default: true
- Introduced in: v3.3.0
enable_view_based_mv_rewriteβ
- Description: Whether to enable query rewrite for logical view-based materialized views. If this item is set to
true, the logical view is used as a unified node to rewrite the queries against itself for better performance. If this item is set tofalse, the system transcribes the queries against logical views into queries against physical tables or materialized views and then rewrites them. - Default: false
- Introduced in: v3.1.9, v3.2.5, v3.3.0
enable_materialized_view_union_rewriteβ
- Description: Whether to enable materialized view union rewrite. If this item is set to
true, the system seeks to compensate the predicates using UNION ALL when the predicates in the materialized view cannot satisfy the query's predicates. - Default: true
- Introduced in: v2.5.20, v3.1.9, v3.2.7, v3.3.0
enable_materialized_view_plan_cacheβ
- Description: Whether to enable materialized view plan cache, which can optimize the automatic rewrite performance of materialized views. Setting it to
trueindicates enabling it. - Default: true
- Introduced in: v2.5.13, v3.0.7, v3.1.4, v3.2.0, v3.3.0
enable_cbo_based_mv_rewriteβ
- Description: Whether to enable materialized view rewrite in CBO phase which can maximize the likelihood of successful query rewriting (e.g., when the join order differs between materialized views and queries), but it will increase the execution time of the optimizer phase.
- Default: true
- Introduced in: v3.5.5, v4.0.1
enable_parquet_reader_bloom_filterβ
- Description: Whether to enable the bloom filter of Parquet file to improve performance.
trueindicates enabling the bloom filter, andfalseindicates disabling it. You can also control this behavior on system level using the BE configurationparquet_reader_bloom_filter_enable. Bloom filters in Parquet are maintained at the column level within each row group. If a Parquet file contains bloom filters for certain columns, queries can use predicates on those columns to efficiently skip row groups. - Default: true
- Introduced in: v3.5
enable_plan_advisorβ
- Description: Whether to enable Query Feedback feature for slow queries and manually marked queries.
- Default: true
- Introduced in: v3.4.0
enable_plan_analyzerβ
- Description: Whether to enable Query Feedback feature for all queries. This variable takes effect only when
enable_plan_advisoris set totrue. - Default: false
- Introduced in: v3.4.0
enable_parquet_reader_bloom_filterβ
- Default: true
- Type: Boolean
- Unit: -
- Description: Whether to enable Bloom Filter optimization when reading Parquet files.
true(Default): Enable Bloom Filter optimization when reading Parquet files.false: Disable Bloom Filter optimization when reading Parquet files.
- Introduced in: v3.5.0
enable_parquet_reader_page_indexβ
- Default: true
- Type: Boolean
- Unit: -
- Description: Whether to enable Page Index optimization when reading Parquet files.
true(Default): Enable Page Index optimization when reading Parquet files.false: Disable Page Index optimization when reading Parquet files.
- Introduced in: v3.5.0
follower_query_forward_modeβ
-
Description: Specifies to which FE nodes the query statements are routed.
-
Valid values:
default: Routes the query statement to the Leader FE or Follower FEs, depending on the Follower's replay progress. If the Follower FE nodes have not completed replay progress, queries will be routed to the Leader FE node. If the replay progress is complete, queries will be preferentially routed to the Follower FE node.leader: Routes the query statement to the Leader FE.follower: Routes the query statement to Follower FE.
-
-
Default: default
-
Data type: String
-
Introduced in: v2.5.20, v3.1.9, v3.2.7, v3.3.0
character_set_database (global)β
- Data type: StringThe character set supported by StarRocks. Only UTF8 (
utf8) is supported. - Default: utf8
- Data type: String
connector_io_tasks_per_scan_operatorβ
- Description: The maximum number of concurrent I/O tasks that can be issued by a scan operator during external table queries. The value is an integer. Currently, StarRocks can adaptively adjust the number of concurrent I/O tasks when querying external tables. This feature is controlled by the variable
enable_connector_adaptive_io_tasks, which is enabled by default. - Default: 16
- Data type: Int
- Introduced in: v2.5
connector_sink_compression_codecβ
- Description: Specifies the compression algorithm used for writing data into Hive tables or Iceberg tables, or exporting data with Files(). This parameter only takes effect in the following situations:
- The
compression_codecproperty does not exist in the Hive tables. - The
write.parquet.compression-codecproperties do not exist in the Iceberg tables. - The
compressionproperty is not set forINSERT INTO FILES.
- The
- Valid values:
uncompressed,snappy,lz4,zstd, andgzip. - Default: uncompressed
- Data type: String
- Introduced in: v3.2.3
connector_sink_target_max_file_sizeβ
- Description: Specifies the maximum size of target file for writing data into Hive tables or Iceberg tables, or exporting data with Files(). The limit is not exact and is applied on a best-effort basis.
- Unit: Bytes
- Default: 1073741824
- Data type: Long
- Introduced in: v3.3.0
count_distinct_column_bucketsβ
- Description: The number of buckets for the COUNT DISTINCT column in a group-by-count-distinct query. This variable takes effect only when
enable_distinct_column_bucketizationis set totrue. - Default: 1024
- Introduced in: v2.5
count_distinct_implementationβ
- Description: Controls the function implementation when
COUNT(DISTINCT expr)contains only one parameter. Valid values (case-insensitive):default: Reserves theCOUNT(DISTINCT expr)implementation. The optimizer chooses the suitable aggregation plan based on query form, statistics, and costs.multi_count_distinct: Changes theCOUNT(DISTINCT expr)implementation tomulti_distinct_countfor precise counting. For counting on low- and medium-cardinality columns, this implementation can reduce a shuffle and deduplication phase, and thereby increase the speed. However, it will reserve the distinct values in HashSet, causing excessive memory consumption and even OOM when deduplicating high-cardinality columns. Do not set this value globally without first verifying it using representative loads.ndv:Changes theCOUNT(DISTINCT expr)implementation tondv(expr). This function uses HyperLogLog, which returns approximate results with lower memory overhead.
- Default:
default - Introduced in: v3.3.6γv3.4.0
multi_distinct_countmulti_distinct_count() returns precise results.
For most queries, COUNT(DISTINCT expr) is recommended. Set count_distinct_implementation to default to allow the optimizer to choose a suitable aggregation plan.
When deduplicating low- and medium-cardinality columns, you can test and use multi_distinct_count(). This function uses two phases of aggregation, and can reduce a shuffle and deduplication phase for better performance. However, its HashSet status and final merging can cause excessive memory consumption and even OOM when deduplicating high-cardinality columns.
If you want to test this implementation on one COUNT(DISTINCT expr) instead of changing the whole session, you can set count_distinct_implementation in a query hint:
SELECT /*+ SET_VAR(count_distinct_implementation = multi_count_distinct) */
COUNT(DISTINCT category)
FROM test;
Setting this value with hints applies only to COUNT(DISTINCT) with a single parameter. It will not affect multi-column deduplication expressions such as COUNT(DISTINCT expr1, expr2).
custom_query_id (session)β
- Description: Used to bind some external identifier to a current query. Can be set using
SET SESSION custom_query_id = 'my-query-id';before executing a query. The value is reset after query is finished. This value can be passed toKILL QUERY 'my-query-id'. Value can be found in audit logs as acustomQueryIdfield. - Default: ""
- Data type: String
- Introduced in: v3.4.0
datacache_sharing_work_periodβ
- Description: The period of time that Cache Sharing takes effect. After each cluster scaling operation, only the requests within this period of time will try to access the cache data from other nodes if the Cache Sharing feature is enabled.
- Default: 600
- Unit: Seconds
- Introduced in: v3.5.1
default_authentication_pluginβ
- Scope: Session
- Description: Session-scoped variable that specifies the default MySQL authentication plugin name for this session. It is stored as SessionVariable.defaultAuthenticationPlugin and is used by StarRocks' MySQL-protocol compatibility layers when the server needs to advertise or use a default authentication plugin (for example during handshake or when a plugin is not specified). Accepts standard MySQL authentication plugin identifiers (e.g.
mysql_native_password,caching_sha2_password) supported by the server. This variable affects session behavior only; persistent user account authentication configuration is managed separately. See related session variableauthentication_policy. - Default:
mysql_native_password - Data Type: String
- Introduced in: -
default_rowset_type (global)β
Used to set the default storage format used by the storage engine of the computing node. The currently supported storage formats are alpha and beta.
default_table_compressionβ
-
Description: The default compression algorithm for table storage. Supported compression algorithms are
snappy, lz4, zlib, zstd.Note that if you specified the
compressionproperty in a CREATE TABLE statement, the compression algorithm specified bycompressiontakes effect. -
Default: lz4_frame
-
Introduced in: v3.0
disable_colocate_joinβ
- Description: Used to control whether the Colocation Join is enabled. The default value is
false, meaning the feature is enabled. When this feature is disabled, query planning will not attempt to execute Colocation Join. - Default: false
disable_streaming_preaggregationsβ
Used to enable the streaming pre-aggregations. The default value is false, meaning it is enabled.
div_precision_incrementβ
Used for MySQL client compatibility. No practical usage.
dynamic_overwriteβ
- Description: Whether to enable the Dynamic Overwrite semantic for INSERT OVERWRITE with partitioned tables. Valid values:
true: Enables Dynamic Overwrite.false: Disables Dynamic Overwrite and uses the default semantic.
- Default: false
- Introduced in: v3.4.0
enable_adaptive_sink_dopβ
- Description: Specifies whether to enable adaptive parallelism for data loading. After this feature is enabled, the system automatically sets load parallelism for INSERT INTO and Broker Load jobs, which is equivalent to the mechanism of
pipeline_dop. For a newly deployed v2.5 StarRocks cluster, the value istrueby default. For a v2.5 cluster upgraded from v2.4, the value isfalse. - Default: false
- Introduced in: v2.5
enable_bucket_aware_execution_on_lakeβ
- Description: Whether to enable bucket-aware execution for queries against data lakes (such as Iceberg tables). When this feature is enabled, the system optimizes query execution by leveraging bucketing information to reduce data shuffling and improve performance. This optimization is particularly effective for join operations and aggregations on bucketed tables.
- Default: true
- Data type: Boolean
- Introduced in: v4.0
enable_cbo_based_mv_rewriteβ
- Description: Whether to enable materialized view rewrite in CBO phase which can maximize the likelihood of successful query rewriting (e.g., when the join order differs between materialized views and queries), but it will increase the execution time of the optimizer phase.
- Default: true
- Introduced in: v3.5.5, v4.0.1
enable_cbo_table_pruneβ
- Description: When enabled, the optimizer will add the CBO table pruning rule (CboTablePruneRule) during memo optimization to perform cost-based table pruning for cardinality-preserving joins. The rule is conditionally added in the optimizer (see QueryOptimizer.memoOptimize and SPMOptimizer.memoOptimize) only when the join-node count in the join tree is small (fewer than 10 join nodes). This option complements the rule-based pruning toggle
enable_rbo_table_pruneand lets the Cost-Based Optimizer try to remove unnecessary tables or inputs from join processing to reduce planning and execution complexity. Default is off because pruning can change plan shape; enable it only after validating on representative workloads. - Scope: Session
- Default:
false - Data Type: boolean
- Introduced in: v3.2.0
enable_cache_udafβ
- Description: When set to
true, enables in-memory caching of the class-level Java UDAF initialization (class loading, method introspection, and batch-update stub generation). The cache is populated on first use and reused across all aggregator/analytor instances within the same BE process, eliminating the repeated per-instance initialization overhead that is otherwise proportional to pipeline DOP. Caching only applies to UDAFs and window functions that were created with"isolation" = "shared". Functions created with"isolation" = "private"always go through the uncached path regardless of this setting. Default isfalse; enable after verifying that shared-isolation UDAFs are safe to share their class-level state across concurrent queries. The runtime profile exposesUdafCacheHitCount,UdafCachePopulateCount, andUdafLoadTimecounters to observe cache behavior. - Scope: Session
- Default:
false - Data Type: boolean
- Introduced in: v3.4.0
enable_color_explain_outputβ
- Scope: Session
- Description: Controls whether ANSI color escape sequences are included in textual EXPLAIN / PROFILE outputs. When enabled (
true), StmtExecutor passes the session setting into the explain/profile pipeline (via calls to ExplainAnalyzer) so explain, EXPLAIN ANALYZE and analyze-profile outputs contain colored highlighting for readability in ANSI-capable terminals. When disabled (false), the output is produced without ANSI sequences (plain text), which is appropriate for logging, clients that do not support ANSI, or when piping output to files. This is a per-session toggle and does not change execution semanticsβonly the presentation of explain/profile text. - Default:
true - Data type: boolean
- Introduced in: v3.5.0
enable_connector_adaptive_io_tasksβ
- Description: Whether to adaptively adjust the number of concurrent I/O tasks when querying external tables. Default value is
true. If this feature is not enabled, you can manually set the number of concurrent I/O tasks using the variableconnector_io_tasks_per_scan_operator. - Default: true
- Introduced in: v2.5
enable_cost_based_multi_stage_aggβ
- Description: Controls whether the new planner uses cost-based decisions to generate and compare multi-stage aggregation plans for queries with DISTINCT aggregates. When enabled, the optimizer may produce alternative 3-stage and 4-stage aggregation candidates and rely on cost estimates to pick the better plan. It also enables post-processing in
PruneAggregateNodeRuleto merge or prune split aggregate nodes when beneficial (that is, reducing unnecessary serialization or deserialization). Note that the effective check in code is gated bynew_planner_agg_stageβ the helperisEnableCostBasedMultiStageAgg()returns true only whennew_planner_agg_stageis set toAUTOand this parameter is set totrue; ifnew_planner_agg_stageis non-AUTO, this parameter will not enable cost-based multi-stage behavior. Disabling this flag forces the planner to prefer the simpler 3-stage transformation for distinct aggregations and skips cost-driven candidate generation and certain aggregate-node merges. - Scope: Session
- Default:
true - Data Type: boolean
- Introduced in: -
enable_datacache_async_populate_modeβ
- Description: Whether to populate the data cache in asynchronous mode. By default, the system uses the synchronous mode to populate data cache, that is, populating the cache while querying data.
- Default: false
- Introduced in: v3.2.7
enable_connector_adaptive_io_tasksβ
- Description: Whether to adaptively adjust the number of concurrent I/O tasks when querying external tables. Default value is
true. If this feature is not enabled, you can manually set the number of concurrent I/O tasks using the variableconnector_io_tasks_per_scan_operator. - Default: true
- Introduced in: v2.5
enable_distinct_column_bucketizationβ
-
Description: Whether to enable bucketization for the COUNT DISTINCT colum in a group-by-count-distinct query. Use the
select a, count(distinct b) from t group by a;query as an example. If the GROUP BY columais a low-cardinality column and the COUNT DISTINCT columnbis a high-cardinality column which has severe data skew, performance bottleneck will occur. In this situation, you can split data in the COUNT DISTINCT column into multiple buckets to balance data and prevent data skew. You must use this variable with the variablecount_distinct_column_buckets.You can also enable bucketization for the COUNT DISTINCT column by adding the
skewhint to your query, for example,select a,count(distinct [skew] b) from t group by a;. -
Default: false, which means this feature is disabled.
-
Introduced in: v2.5
enable_group_by_compressed_keyβ
- Description: Whether to use accurate statistical information to compress the GROUP BY Key column. Valid values:
trueandfalse. - Default: true
- Introduced in: v4.0
enable_gin_filterβ
- Description: Whether to utilize the fulltext inverted index during queries.
- Default: true
- Introduced in: v3.3.0
enable_group_executionβ
- Description: Whether to enable Colocate Group Execution. Colocate Group Execution is an execution pattern that leverages physical data partitioning, where a fixed number of threads sequentially process their respective data ranges to enhance locality and throughput. Enabling this feature can reduce memory usage.
- Default: true
- Introduced in: v3.3
enable_group_level_query_queue (global)β
- Description: Whether to enable resource group-level query queue.
- Default: false, which means this feature is disabled.
- Introduced in: v3.1.4
enable_insert_partial_updateβ
- Description: Whether to enable Partial Update for INSERT statements on Primary Key tables. When this item is set to
true(default), if an INSERT statement specifies only a subset of columns (fewer than the number of all non-generated columns in the table), the system performs a Partial Update to update only the specified columns while preserving existing values in other columns. When set tofalse, the system uses default values for unspecified columns instead of preserving existing values. This feature is particularly useful for updating specific columns in Primary Key tables without affecting other column values. - Default: true
- Introduced in: v3.3.20, v3.4.9, v3.5.8, v4.0.2
enable_iceberg_metadata_cacheβ
- Description: Whether to cache pointers and partition names for Iceberg tables. From v3.2.1 to v3.2.3, this parameter is set to
trueby default, regardless of what metastore service is used. In v3.2.4 and later, if the Iceberg cluster uses AWS Glue as metastore, this parameter still defaults totrue. However, if the Iceberg cluster uses other metastore service such as Hive metastore, this parameter defaults tofalse. - Introduced in: v3.2.1
max_unknown_string_meta_length (global)β
- Description: Fallback length for string columns in query result metadata when the max length is unknown. Clients that rely on the metadata may return empty values or truncation if the reported length is smaller than actual values. Valid range is
1to1048576. - Default: 64
- Data Type: int
- Introduced in: v3.5.13
enable_reduce_cast_varchar_length_inheritance (global)β
- Description: Whether to preserve the target
VARCHAR(N)length whenReduceCastRuleeliminates a same-typeVARCHAR -> VARCHARcast. Enable this variable to keep prepare and execute result-set metadata consistent for statements such asCAST(col AS VARCHAR(N)). - Default: false
- Data Type: Boolean
- Introduced in: v4.0.9
enable_reduce_cast_varchar_expr_sync_type (global)β
- Description: Whether to synchronize the reused planner
Exprtype and origin type with the rewrittenVARCHAR(N)type afterReduceCastRuleeliminates a same-typeVARCHAR -> VARCHARcast. - Default: true
- Data Type: Boolean
- Introduced in: v4.0.9
enable_metadata_profileβ
- Description: Whether to enabled Profile for Iceberg Catalog metadata.
- Default: true
- Introduced in: v3.3.3
plan_modeβ
- Description: The metadata retrieval strategy of Iceberg Catalog. For more information, see Iceberg Catalog metadata retrieval strategy. Valid values:
auto: The system will automatically select the retrieval plan.local: Use the local cache plan.distributed: Use the distributed plan.
- Default: auto
- Introduced in: v3.3.3
enable_iceberg_column_statisticsβ
- Description: Whether to obtain column statistics, such as
min,max,null count,row size, andndv(if a puffin file exists). When this item is set tofalse, only the row count information will be collected. - Default: false
- Introduced in: v3.4
enable_parallel_mergeβ
- Description: Whether to enable parallel merge for sorting. When this feature is enabled, the merge phase of sorting will utilize multiple threads for merge operations.
- Default: true
- Introduced in: v3.3
enable_per_bucket_optimizeβ
- Description: Whether to enable bucketed computation. When this feature is enabled, stage-one aggregation can be computed in bucketed order, reducing memory usage.
- Default: true
- Introduced in: v3.0
metadata_collect_query_timeoutβ
- Description: The timeout duration for Iceberg Catalog metadata collection queries.
- Unit: Second
- Default: 60
- Introduced in: v3.3.3
enable_insert_strictβ
- Description: Whether to enable strict mode while loading data using INSERT from files(). Valid values:
trueandfalse(Default). When strict mode is enabled, the system loads only qualified rows. It filters out unqualified rows and returns details about the unqualified rows. For more information, see Strict mode. In versions earlier than v3.4.0, whenenable_insert_strictis set totrue, the INSERT jobs fails when there is an unqualified rows. - Default: true
insert_max_filter_ratioβ
- Description: The maximum error tolerance of INSERT from files(). It's the maximum ratio of data records that can be filtered out due to inadequate data quality. When the ratio of unqualified data records reaches this threshold, the job fails. Range: [0, 1].
- Default: 0
- Introduced in: v3.4.0
insert_timeoutβ
- Description: The timeout duration of the INSERT job. Unit: Seconds. From v3.4.0 onwards,
insert_timeoutapplies to operations involved INSERT (for example, UPDATE, DELETE, CTAS, materialized view refresh, statistics collection, and PIPE), replacingquery_timeout. - Default: 14400
- Introduced in: v3.4.0
enable_materialized_view_for_insertβ
- Description: Whether to allow StarRocks to rewrite queries in INSERT INTO SELECT statements.
- Default: false, which means Query Rewrite in such scenarios is disabled by default.
- Introduced in: v2.5.18, v3.0.9, v3.1.7, v3.2.2
enable_rule_based_materialized_view_rewriteβ
- Description: Controls whether to enable rule-based materialized view query rewrite. This variable is mainly used in single-table query rewrite. * Default: true
- Data type: Boolean
- Introduced in: v2.5
enable_short_circuitβ
- Description: Whether to enable short circuiting for queries. Default:
false. If it is set totrue, when the query meets the criteria (to evaluate whether the query is a point query): the conditional columns in the WHERE clause include all primary key columns, and the operators in the WHERE clause are=orIN, the query takes the short circuit. - Default: false
- Introduced in: v3.2.3
enable_spm_rewriteβ
- Description: Whether to enable SQL Plan Manager (SPM) query rewrite. When enabled, StarRocks automatically rewrites queries to use bound query plans, improving query performance and stability.
- Default: false
enable_spillβ
- Description: Whether to enable intermediate result spilling. Default:
false. If it is set totrue, StarRocks spills the intermediate results to disk to reduce the memory usage when processing aggregate, sort, or join operators in queries. - Default: false
- Introduced in: v3.0
enable_spill_to_remote_storageβ
- Description: Whether to enable intermediate result spilling to object storage. If it is set to
true, StarRocks spills the intermediate results to the storage volume specified inspill_storage_volumeafter the capacity limit of the local disk is reached. For more information, see Spill to object storage. - Default: false
- Introduced in: v3.3.0
enable_strict_order_byβ
- Description: Used to check whether the column name referenced in ORDER BY is ambiguous. When this variable is set to the default value
TRUE, an error is reported for such a query pattern: Duplicate alias is used in different expressions of the query and this alias is also a sorting field in ORDER BY, for example,select distinct t1.* from tbl1 t1 order by t1.k1;. The logic is the same as that in v2.3 and earlier. When this variable is set toFALSE, a loose deduplication mechanism is used, which processes such queries as valid SQL queries. - Default: true
- Introduced in: v2.5.18 and v3.1.7
enable_profileβ
-
Description: Specifies whether to send the profile of a query for analysis. The default value is
false, which means no profile is required.By default, a profile is sent to the FE only when a query error occurs in the BE. Profile sending causes network overhead and therefore affects high concurrency.
If you need to analyze the profile of a query, you can set this variable to
true. After the query is completed, the profile can be viewed on the web page of the currently connected FE (address:fe_host:fe_http_port/query). This page displays the profiles of the latest 100 queries withenable_profileturned on. -
Default: false
enable_query_queue_load (global)β
- Description: Boolean value to enable query queues for loading tasks.
- Default: false
enable_query_queue_select (global)β
- Description: Whether to enable query queues for SELECT queries.
- Default: false
enable_query_queue_statistic (global)β
- Description: Whether to enable query queues for statistics queries.
- Default: false
enable_query_tablet_affinityβ
-
Description: Boolean value to control whether to direct multiple queries against the same tablet to a fixed replica.
In scenarios where the table to query has a large number of tablets, this feature significantly improves query performance because the meta information and data of the tablet can be cached in memory more quickly.
However, if there are some hotspot tablets, this feature may degrade the query performance because it directs the queries to the same BE, making it unable to fully use the resources of multiple BEs in high concurrency scenarios.
-
Default: false, which means the system selects a replica for each query.
-
Introduced in: v2.5.6, v3.0.8, v3.1.4, and v3.2.0.
enable_lake_tablet_internal_parallelβ
- Description: Whether to enable Parallel Scan for Cloud-native tables in a shared-data cluster.
- Default: true
- Data type: Boolean
- Introduced in: v3.3.0
tablet_internal_parallel_modeβ
- Description: Internal Parallel Scan strategy of tablets. Valid Values:
auto: When the number of Tablets to be scanned on BE or CN nodes is less than the Degree of Parallelism (DOP), the system automatically determines whether Parallel Scan is needed based on the estimated size of the Tablets.force_split: Forces the splitting of Tablets and performs Parallel Scan.
- Default: auto
- Data type: String
- Introduced in: v2.5.0
enable_scan_datacacheβ
- Description: Specifies whether to enable the Data Cache feature. After this feature is enabled, StarRocks caches hot data read from external storage systems into blocks, which accelerates queries and analysis. For more information, see Data Cache. In versions prior to 3.2, this variable was named as
enable_scan_block_cache. - Default: true
- Introduced in: v2.5
populate_datacache_modeβ
- Description: Specifies the population behavior of Data Cache when reading data blocks from external storage systems. Valid values:
auto(default): the system automatically caches data selectively based on the population rule.always: Always cache the data.never: Never cache the data.
- Default: auto
- Introduced in: v3.3.2
enable_datacache_io_adaptorβ
- Description: Whether to enable the Data Cache I/O Adaptor. Setting this to
trueenables the feature. When this feature is enabled, the system automatically routes some cache requests to remote storage when the disk I/O load is high, reducing disk pressure. - Default: true
- Introduced in: v3.3.0
enable_file_metacacheβ
- Description: Whether to enable metadata cache for files in remote storage (Footer Cache). Setting this to
trueenables the feature. Footer Cache directly caches the parsed Footer object in memory. When the same file's Footer is accessed in subsequent queries, the object descriptor can be obtained directly from the cache, avoiding repetitive parsing. This feature uses the memory module of the Data Cache for data caching. Therefore, you must ensure that the BE parameterdatacache_enableis set totrueand configure a reasonable value fordatacache_mem_size. - Default: true
- Introduced in: v3.3.0
enable_file_pagecacheβ
- Description: Whether to enable Page Cache for files in remote storage. Setting this to
trueenables the feature. Page Cache stores decompressed Parquet page data in memory. When the same page is accessed in subsequent queries, the data can be obtained directly from the cache, avoiding repetitive I/O operations and decompression. This feature works together with the Data Cache and uses the same memory module. When enabled, Page Caache can significantly improve query performance for workloads with repetitive page access patterns. - Default: true
- Introduced in: v4.0
enable_datacache_sharingβ
- Description: Whether to enable Cache Sharing. Setting this to
trueenables the feature. Cache Sharing is used to support accessing cache data from other nodes through the network, which can help to reduce performance jitter caused by cache invalidation during cluster scaling. This variable takes effect only when the FE parameterenable_trace_historical_nodeis set totrue. - Default: true
- Introduced in: v3.5.1
datacache_sharing_work_periodβ
- Description: The period of time that Cache Sharing takes effect. After each cluster scaling operation, only the requests within this period of time will try to access the cache data from other nodes if the Cache Sharing feature is enabled.
- Default: 600
- Unit: Seconds
- Introduced in: v3.5.1
historical_nodes_min_update_intervalβ
- Description: The minimum interval between two updates of historical node records. If the nodes of a cluster change frequently in a short period of time (that is, less than the value set in this variable), some intermediate states will not be recorded as valid historical node snapshots. The historical nodes are the main basis for the Cache Sharing feature to choose the right cache nodes during cluster scaling.
- Default: 600
- Unit: Seconds
- Introduced in: v3.5.1