Optimizer Method Configuration
These configuration parameters provide a crude method of influencing the query plans chosen by the query optimizer. If the default plan chosen by the optimizer for a particular query is not optimal, a temporary solution is to use one of these configuration parameters to force the optimizer to choose a different plan. Better ways include adjusting the optimizer cost constants, manually running ANALYZE, increasing the value of the default_statistics_target parameter, and increasing the amount of the statistics collected in specific columns using ALTER TABLE SET STATISTICS.
enable_bitmapscan
Parameter description: Specifies the query optimizer's use of bitmap-scan plan types.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: After this function is disabled, the bitmap scan operator is disabled globally, which may cause performance deterioration in some scenarios. Exercise caution when modifying the parameter to avoid risks caused by misoperations.
force_bitmapand
Parameter description: Specifies whether the query optimizer forcibly uses BitmapAnd plan types.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: off
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: After this parameter is enabled, the optimizer forcibly performs bitmap and index scan when the conditions for using the bitmap and index scan operator are met. In some scenarios, the query performance may be affected. Exercise caution when modifying the parameter to avoid risks caused by misoperations.
enable_hashagg
Parameter description: Specifies the query optimizer's use of Hash aggregation plan types.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is disabled, the Hash aggregation operator cannot be used in some scenarios, affecting the query rewriting logic and deteriorating the query performance. Exercise caution when modifying the parameter to avoid risks caused by misoperations.
enable_hashjoin
Parameter description: Specifies whether the optimizer uses hash join plan types.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: After this function is disabled, the Hash Join operator cannot be used globally and other Join plans are preferentially generated. As a result, the performance may deteriorate in some scenarios. Exercise caution when modifying the parameter to avoid risks caused by misoperations.
enable_indexscan
Parameter description: Specifies whether the optimizer uses index-scan plan types.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: After this function is disabled, the index scan operator is disabled globally, which may cause performance deterioration in some scenarios. Exercise caution when modifying the parameter to avoid risks caused by misoperations.
enable_indexonlyscan
Parameter description: Specifies whether the optimizer uses index-only-scan plan types.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: After this function is disabled, the index-only-scan operator cannot be used globally. Some plans that require only index scan but do not require table return cannot be generated. As a result, the performance may deteriorate in some scenarios. Exercise caution when modifying the parameter to avoid risks caused by misoperations.
enable_gsiscan
Parameter description: Specifies whether the query optimizer uses global secondary-index-only scan plan types.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: In scenarios where global secondary indexes are available, if this parameter is disabled, only global secondary index scan plans cannot be generated, which may affect the query performance.
enable_gsitablescan
Parameter description: Specifies whether the query optimizer uses the global secondary index table scan plan types.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: In scenarios where global secondary indexes are available, if this parameter is disabled, only global secondary index scan plans cannot be generated, which may affect the query performance.
gsi_fastpath_level
- A single table, no subquery, no sublink, or the target table is not a view.
- The query statement cannot generate an execution plan for an ordinary index.
- The query statement cannot generate the IndexOnlyScan execution plan of GSI.
- Query statements do not contain scan hints, such as TableScan and IndexScan.
- The WHERE condition contains an equivalent condition that contains the index key of the candidate GSI (unique and not a partial GSI index).
Parameter type: enumerated type.
Unit: none
Value range:
- strict: The equivalent condition contains all GSI index keys.
- partial: The equivalent condition contains partial index keys (leftmost match) of GSI. The performance may not be optimal.
- none: disabled.
Default value: strict
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: Improper settings may affect plan generation in some GSI scenarios, affecting query performance.
gaussdb=# CREATE TABLE t1(a INT, b INT, c INT); gaussdb=# CREATE GLOBAL UNIQUE INDEX t1_gsi ON t1(b,c); -- Q1 gaussdb=# SELECT * FROM t1 WHERE b=1; -- Q2 gaussdb=# SELECT * FROM t1 WHERE b=1 LIMIT 1;
In the preceding scenario, the GSI is created on the b and c columns. When gsi_fastpath_level is set to partial, the GSI non-stream return plan can be generated for query statements Q1 and Q2. The uniqueness of an index is ensured by the b and c columns. For query statement Q1, multiple results may be returned. The performance of the GSI non-stream return plan may not be optimal. For query statement Q2, the limit 1 condition is included, the performance of the GSI non-stream return plan is still optimal.
enable_default_gsi
Parameter description: (1) Specifies whether to create a global secondary index (GSI) by default when the primary key constraint or unique constraint is added to a column that does not contain a distribution key during table creation. (2) Specifies whether a GSI can be created for a hash bucket table.
Parameter type: Boolean.
Unit: none
Value range:
- on: (1) A GSI is created by default when the primary key constraint or unique constraint is added to a column that does not contain a distribution key during table creation. (2) A GSI can be created for a hash bucket table.
- off: (1) A GSI is not created by default when the primary key constraint or unique constraint is added to a column that does not contain a distribution key during table creation. The table fails to be created. (2) A GSI cannot be created for a hash bucket table.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value. You need to determine whether to enable this parameter based on the actual application scenario.
Risks and impacts of improper settings:
- Setting this parameter to off: (1) The primary key constraint or unique constraint cannot be added to columns that do not contain distribution keys during table creation. You are advised to add distribution keys by reconstructing services. (2) GSIs cannot be created for hash bucket tables.
- If this parameter is set to on: (1) GSIs are created by default. PRIMARY KEY constraints or UNIQUE constraints can be added to columns that do not contain distribution keys in the table. Note that if GSIs are created on the table, DML operations may cause potential performance deterioration. (2) Some indexes and GSIs in the form of expression indexes on hash bucket tables are rebuilt offline during redistribution. During the rebuilding, services are blocked. GSIs that are not partial indexes or expression indexes are rebuilt online during redistribution, and services are not blocked. GSIs are valid during scale-out and redistribution.
enable_gsi_iud_returning
Parameter description: Specifies whether to enable the RETURNING functionality when INSERT, UPDATE, and DELETE operations are performed on a base table with GSIs.
Parameter type: Boolean.
Unit: none
Value range:
- on: enable.
- off: disabled.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is disabled when INSERT, UPDATE, or DELETE operations are performed on a base table with GSIs, the RETURNING functionality will not be supported.
enable_gsi_distkey_update
Parameter description: Specifies whether to enable the functionality of updating the distribution key of a GSI (UPDATE, UPSERT, and MERGE INTO).
Parameter type: Boolean.
Unit: none
Value range:
- on: enable.
- off: disabled.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is disabled, the distribution key of the GSI cannot be updated.
enable_gsi_dml_lp_opt
Parameter description: Specifies whether the optimizer executes the determination system of simple DML rules of the GSI to optimize the execution of simple DML statements. The simple DML optimization rules of the GSI are as follows:
- For INSERT statements, only the following simple INSERT statements are supported:
- Only a single VALUES clause is supported. Multiple VALUES clauses are not supported.
- The values in VALUES must be constants or parameters (expressions are not supported).
- The RETURNING clause, subqueries in any form, and UPSERT statements are not supported.
- The target table must be a single table that has no more than one GSI. The GSI must be an ordinary GSI (expression indexes or partial indexes are not supported) and cannot contain columns of user-defined types.
- Other DML statements: Not supported currently.
- This parameter must be set on both CNs and DNs.
Parameter type: Boolean.
Unit: none
Value range:
- on: enable.
- off: disabled.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is disabled, GSI DML Light Proxy optimization is not supported, which may cause performance deterioration in some GSI DML scenarios.
enable_material
Parameter description: Specifies whether the query optimizer uses materialization. It is impossible to suppress materialization entirely, but setting this parameter to off prevents the optimizer from inserting materialized nodes.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: After this function is disabled, the optimizer is prohibited from inserting entity nodes. As a result, the Material operator cannot be generated in some scenarios, and the performance may deteriorate in some scenarios.
enable_mergejoin
Parameter description: Specifies whether the optimizer uses merge-join plan types.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: off
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is enabled, the optimizer generates a merge join path for joins that meet the conditions. As a result, the selected join operator in this scenario may not be the optimal one.
enable_nestloop
Parameter description: Specifies whether the query optimizer uses nested-loop join plan types to fully scan internal tables. It is impossible to eliminate nested-loop joins. However, if this parameter is disabled, the optimizer prefers other methods when other methods exist.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: off
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is enabled, the optimizer generates a nested-loop join path for joins that meet the conditions. As a result, the selected join operator in this scenario may not be the optimal one.
enable_index_nestloop
Parameter description: Specifies whether the optimizer uses the nested-loop join plan type to scan the parameterized indexes of inner tables.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is disabled, parameterized paths cannot be generated in some scenarios. Generally, parameterized paths can improve query performance. Therefore, you are advised to enable this parameter.
enable_remote_param
Parameter description: Specifies whether to use the XC parameterized path feature. If this parameter is enabled, an XC parameterized path plan can be generated.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value:
- on: default value of the newly installed database.
- off: default value after an upgrade from a version earlier than 505.2.0.
This parameter was introduced in version 505.2.0 and its default value was changed from off to on in version 507.0.0. After an upgrade from a version earlier than 505.2.0, the value of this parameter is off. If this parameter exists and has been set before the upgrade, the original value will be retained after the upgrade.
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: In correlated sublink and nested-loop scenarios, if the outer table is small and the inner table is large, and the inner table has an index that meets the leftmost prefix matching rule in the join condition, you are advised to set this parameter to on. In this configuration, if the cost model selects a parameterized path, the performance can be improved.
Risks and impacts of improper settings: In correlated sublink and nested-loop scenarios, if the outer table is large and the inner table is small, setting this parameter to on and selecting a parameterized path for the cost model may cause performance deterioration.
- The conditions for generating an XC parameterized path are as follows:
- The condition cannot contain expressions that cannot be pushed down (for example, a function whose PROVOLATILE attribute is volatile).
- The condition can match an index according to the leftmost matching rule.
- The WHERE condition of an outer join does not support parameterization.
- XC parameterization supports the following scenarios:
- A parameterized path for nested loops can be generated, and the join condition can be pushed down to the inner table RemoteQuery (including single-table RemoteQuery and RemoteJoinQuery) so that the query result of the outer table can be passed to the inner table as a parameter.
- A parameterized path for subplans can be generated, and the Coordinator Qual on the subplan can be pushed down to the RemoteQuery of the subplan so that the result of the parent query of the subplan can be passed to the inner table as a parameter.
- The limitations on using the XC parameterized path feature are as follows:
- Only XC plans are supported. Stream and FQS plans are not supported.
- A plan with the parameter rescan is generated for the base table only when the index parameterized path is generated for the base table.
- The nested loop parameterized path supports only the scenario where the inner table is RemoteQuery.
- The nested-loop parameterized path does not support pushing parameters down to subqueries.
- The predpush hint is not supported.
- In an M-compatible database, if the max_datanode_for_plan parameter is set to a value greater than 0, the DN plan of the parameterized path cannot be displayed.
- Dynamic DN pruning for remote queries is not supported.
enable_remote_pbe_reuse
Parameter description: Specifies whether to reuse the PBE packets of DNs delivered by the CN as planned by the XC. After this function is enabled, the packets sent by the CN to the DN in the XC plan are changed from unnamed packets to packets with the _disqry_sys_cached prefix. The packets are reused during execution, improving query performance.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is disabled, the XC plan query performance will be affected in some scenarios.
enable_seqscan
Parameter description: Specifies whether the query optimizer uses sequential scan plan types. It is impossible to eliminate sequential scan. However, if this parameter is disabled, the optimizer prefers other methods when other methods exist.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is disabled, the optimizer tends to select other scan methods and lowers the priority of sequential scan methods. In some scenarios, the query performance may be affected.
enable_sort
Parameter description: Specifies whether the optimizer uses sort methods. It is impossible to eliminate explicit sorting. However, if this parameter is disabled, the optimizer prefers other methods when other methods exist.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is disabled, the optimizer prefers other methods and lowers the priority of the sorting method. Therefore, you are advised to enable this parameter.
enable_tidscan
Parameter description: Specifies whether the optimizer uses Tuple ID (TID) scan plan types.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is disabled, the optimizer prefers other methods and lowers the priority of the TID scan method. Therefore, you are advised to enable this parameter.
enable_kill_query
Parameter description: In CASCADE mode, when a user is deleted, all the objects belonging to the user are deleted. This parameter specifies whether the queries of the objects belonging to the user can be unlocked when the user is deleted.
Parameter type: Boolean.
Unit: none
Value range:
- on indicates that the unlocking is allowed.
- off indicates that the unlocking is not allowed.
Default value: off
Setting method: This is a SUSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: After this parameter is enabled, when a user is deleted, the query of the user may be exposed, affecting system consistency and security.
enable_stream_concurrent_update
Parameter description: Specifies the optimizer's use of streams in concurrent update scenarios. This parameter is restricted by the enable_stream_operator parameter. If concurrent update conflicts occur, an error may be reported. This parameter can be used to control the conflict.
Parameter type: Boolean.
Unit: none
Value range:
- on indicates that the optimizer can generate stream plans for the UPDATE statement.
- off indicates that the optimizer can generate only non-stream plans for the UPDATE statement.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is disabled, the optimizer prefers other methods and generates only non-stream plans for update statements. Therefore, you are advised to enable this parameter.
enable_stream_operator
Parameter description: Specifies whether the optimizer uses stream. When the enable_stream_operator parameter is disabled, a large number of logs indicating that the stream plans cannot be pushed down are recorded. If you do not need these logs, you are advised to disable enable_unshipping_log when disabling enable_stream_operator. During bare metal installation, this parameter is set to off.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
- Independent deployment: off
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is set to an improper value, the optimizer cannot generate stream plans, which may deteriorate the query performance.
enable_stream_recursive
Parameter description: Specifies whether to push WITH RECURSIVE join queries to DNs for processing.
Parameter type: Boolean.
Unit: none
Value range:
- on indicates that WITH RECURSIVE join queries will be pushed down to DNs.
- off indicates that WITH RECURSIVE join queries will not be pushed down.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is disabled, the query performance may deteriorate.
max_recursive_times
Parameter description: Specifies the maximum number of WITH RECURSIVE iterations.
Parameter type: integer.
Unit: none
Value range: 0 to 2147483647
Default value: 200
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Set this parameter based on service requirements.
Risks and impacts of improper settings: This parameter is used to prevent an infinite loop of the WITH RECURSIVE statement by using nocycle in hierarchical queries to exit the loop. If you want to adjust the value, make sure you understand the parameter meaning and adjust the value with caution to avoid risks caused by misoperations.
enforce_a_behavior
Parameter description: Specifies the rule matching modes of regular expressions.
Parameter type: Boolean.
Unit: none
Value range:
- on: The A matching rule is used.
- off: The POSIX matching rule is used.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Set this parameter based on the actual service scenario.
Risks and impacts of improper settings: The regular expression in the query statement cannot be matched as expected.
enable_vector_engine
Parameter description: Specifies whether the optimizer uses vectorized engine.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is disabled, the optimizer may fail to generate vectorized query plans for specific scenarios, affecting query performance.
enable_broadcast
Parameter description: Specifies whether the query optimizer uses broadcast distribution method when it evaluates the cost of stream.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: The accuracy of stream plan generation and the query performance are affected.
enable_change_hjcost
Parameter description: Specifies whether the optimizer excludes inner table running costs when selecting the hash join cost path. If it is set to on, tables with a few records and high running costs are more possible to be selected.
Parameter type: Boolean.
Unit: none
Value range:
- on: used.
- off: not used.
Default value: off
Setting method: This is a SUSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: The hash join cost may be incorrectly estimated, affecting the accuracy of generating hash join plans.
best_agg_plan
- hashagg+gather(redistribute)+hashagg
- redistribute+hashagg(+gather)
- hashagg+redistribute+hashagg(+gather)
Parameter type: integer.
Unit: none
Value range: 0 to 3.
- 0: The optimizer generates the optimal plan based on the estimated costs of the three plans.
- 1: The first plan is forcibly generated.
- 2: The second plan is forcibly generated if the group by column can be redistributed. Otherwise, the first plan is generated.
- 3: The third plan is forcibly generated if the group by column can be redistributed. Otherwise, the first plan is generated.
Default value: 0
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: This parameter affects the hashagg generation mode. You are advised to use the default value. If this parameter is set to another value, the corresponding hashagg generation mode is preferred. If this parameter is set to an improper value, the query performance in some scenarios may be affected.
agg_redistribute_enhancement
Parameter description: When the aggregate operation is performed, which contains multiple group by columns and all of the columns are not in the distribution key, you need to select one group by column for redistribution. This parameter specifies the policy of selecting a redistribution key.
Parameter type: Boolean.
Unit: none
Value range:
- on: The column that can be redistributed with the most distinct value evaluated is selected for redistribution.
- off: The first column that can be redistributed is selected for redistribution.
Default value: off
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is enabled, the plan generation time increases, but a more reasonable redistribution key may be selected.
enable_absolute_tablespace
Parameter description: Specifies whether the tablespace can use the absolute path.
Parameter type: Boolean.
Unit: none
Value range:
- on: An absolute path can be used.
- off: No absolute path can be used.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is disabled, absolute paths cannot be used when tablespaces are created. You are advised to set this parameter based on service requirements. No other risk exists.
enable_valuepartition_pruning
Parameter description: Specifies whether the DFS partitioned table is dynamically or statically optimized.
Parameter type: Boolean.
Unit: none
Value range:
- on: The DFS partitioned table is dynamically or statically optimized.
- off: The DFS partitioned table is not dynamically or statically optimized.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: After this parameter is disabled, the query performance of DFS partitioned tables may deteriorate.
expected_computing_nodegroup
Parameter description: Specifies a compute node group or the way to choose such a group. The node group mechanism is internal. You do not need to set it. During join or aggregation operations, a node group can be selected in four modes. In each mode, the specified candidate compute node groups are listed for the optimizer to select the most appropriate one for the current operator.
Parameter type: string.
Unit: none
Value range:
- optimal: The list of candidate compute node groups consists of the node groups where the operator's operation objects are located and the node group that combines all DNs in the node groups on which the current user has the COMPUTE permission.
- query: The list of candidate compute node groups consists of the node groups where the operator's operation objects are located and the node group that combines all DNs in the node groups where base tables involved in the query are located.
- Node group name (when enable_nodegroup_debug is set to off): The list of candidate compute node groups consists of the node groups where the operator's operation objects are located and the specified node group.
- Node group name (when enable_nodegroup_debug is set to on): A specific node group is used as the compute node group.
Default value: query
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: The optimizer may fail to select a better compute node group, affecting query performance.
enable_nodegroup_debug
Parameter description: Specifies whether the optimizer assigns computing workloads to a specific node group when multiple node groups exist in an environment. The node group mechanism is internal. You do not need to set it. This parameter takes effect only when expected_computing_nodegroup is set to a specific node group.
Parameter type: Boolean.
Unit: none
Value range:
- on: Computing workloads are assigned to the node group specified by expected_computing_nodegroup.
- off: No node group is specified for computing.
Default value: off
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: The query performance may be affected.
enable_default_index_deduplication
Parameter description: Specifies whether to deduplicate and compress tuples with duplicate key values for a B-tree index by default. The deduplication and compression functions do not take effect for primary key indexes and unique indexes. When there are a large number of indexes with duplicate key values, the deduplication and compression function can effectively reduce the space occupied by indexes. If the WITH (deduplication set to on/off) syntax is used during index creation, the deduplication parameter is preferentially used to determine whether to use deduplication and compression for the index.
Parameter type: Boolean.
Unit: none
Value range:
- on: The deduplication and compression function is enabled for B-tree indexes.
- off: The deduplication and compression function is disabled for B-tree indexes.
Default value: off
Setting method: This is a POSTMASTER parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value. You can enable this parameter for non-unique indexes, high index key value repetition, and large index space usage.
Risks and impacts of improper settings: In scenarios where non-unique indexes are used and index key values are seldom repeated or unique, the deduplication and compression function slightly deteriorates the index insertion performance.
expr_engine
Parameter description: Specifies the execution mode of an expression.
Parameter type: enumerated type.
Unit: none
Value range:
- EXPR_TREE: The recursive engine of the expression is used.
Default value: EXPR_TREE
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: This parameter can only be set to EXPR_TREE.
Risks and impacts of improper settings: none
The current version does not support expression execution optimization. Therefore, this parameter can only be set to the default value EXPR_TREE.
sql_result_check
Parameter description: Specifies the self-verification function of expression results.
Parameter type: enumerated type.
Unit: none
Value range:
- off: The expression-based result verification functionality is disabled.
- single_select: In the type range that supports expression result verification, if the verification of a column of the numeric precision type fails, an alarm is generated. If the verification of a column of other types fails, an error is thrown.
Default value: off
Setting method: This is a SUSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: When single_check is used, the query execution time increases slightly.
stream_multiple
Parameter description: Specifies the weight used by the optimizer to calculate the final cost of stream operators. The base stream cost is multiplied by this weight to obtain the final cost.
This parameter is applicable only to Redistribute and Broadcast streams.
Parameter type: floating-point
Unit: none
Value range: 0 to DBL_MAX
Default value: 1
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value and adjust the value based on the deployment environment.
Risks and impacts of improper settings: The optimizer may incorrectly estimate the overhead of the stream operator, affecting the query performance.
qrw_inlist2join_optmode
Parameter description: Specifies whether to enable inlist-to-join query rewriting.
Parameter type: string.
Unit: none
Value range:
- disable: The inlist-to-join query rewriting is disabled.
- cost_base: cost-based inlist-to-join query rewriting. That is, whether to use inlist-to-join query rewriting is automatically evaluated based on the cost.
- rule_base: The rule-based inlist-to-join query rewriting is forcibly enabled.
- A positive integer (1 to 2147483647) indicates the threshold of inlist-to-join query rewriting. If the number of elements in the list is greater than the threshold, the rewriting is performed.
Default value: cost_base
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value. Use other values only when manual optimization is required in abnormal scenarios or when the query performance of the plan selected by the optimizer is low.
Risks and impacts of improper settings: Whether the optimizer performs inlist-to-join query rewriting is affected. No better plan is generated due to improper settings.
The following data types can use the inlist-to-join query rewrite function: TINYINT, SMALLINT, INTEGER, BIGINT, NUMERIC, FLOAT4, FLOAT8, BOOLEAN, CHAR, BPCHAR, VARCHAR, NVARCHAR, TEXT, DATE, TIME, TIMEZ, TIMESTAMP, TIMESTAMPTZ, SMALLDATETIME, INTERVAL, TINTERVAL, UNSIGNED TINYINT, UNSIGNED SMALLINT, UNSIGNED INTEGER, and UNSIGNED BIGINT.
skew_option
Parameter description: Specifies whether an optimization policy is used.
Parameter type: enumerated type.
Unit: none
Value range: off, normal, and lazy
- off indicates that the policy is disabled.
- normal indicates that a radical policy is used. All possible skews are optimized.
- lazy indicates that a conservative policy is used. Uncertain skews are ignored.
Default value: normal
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: Whether the optimizer optimizes skew is affected. The plan generation performance or query execution performance is affected due to improper settings.
default_limit_rows
Parameter description: Specifies the default estimated number of limit rows for generating genericplan.
Parameter type: floating-point
Unit: none
Value range: –100 to DBL_MAX. The recommended value range is 0.1 to 10000. If the value is beyond this range, service risks may occur.
- If this parameter is set to a non-negative number, the value is used as the estimated number of limit rows.
- If this parameter is set to a negative value, the value is used as the default estimated number in percentage. A negative value is converted to the default percentage, that is, –5 indicates 5%.
Default value: -10
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: The genericplan query performance of the limit operator may be affected.
check_implicit_conversions
Parameter description: Specifies whether to check candidate index paths generated for index columns that have implicit type conversion in a query. For details about the application scenarios of this parameter, see "Checking the Implicit Conversion Performance" in SQL Optimization Guide.
Parameter type: Boolean.
Unit: none
Value range:
- on: A check will be performed for candidate index paths generated for index columns that have implicit type conversion in a query.
- off: No check will be performed.
Default value: off
- When this parameter is set to on, you need to set enable_fast_query_shipping to off so that the mechanism for identifying implicit data type conversion in index columns can take effect.
- This parameter is used to check implicit conversion performance issues. Disable this parameter in the formal production environment.
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impact of improper settings: If the check is not performed, the regular expression in the query statement may not be matched as expected.
cost_weight_index
Parameter description: Specifies the cost weight of index_scan.
Parameter type: floating-point
Unit: none
Value range: 1e-6 to 1e+10
Default value: 1
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: This parameter specifies whether the optimizer uses index_scan. The optimizer may use a non-optimal plan due to improper settings, affecting query performance.
try_vector_engine_strategy
Parameter description: Specifies the policy for processing row-store tables by using the vectorized engine. By setting this parameter, queries containing row-store tables can be converted to vectorized execution plans for calculation, improving the execution performance of complex queries in AP-like scenarios.
Parameter type: enumerated type.
Unit: none
Value range:
- off: This function is disabled. That is, row-store tables will not be converted into vectorized execution plans for execution.
- force: The base table to be queried is a row-store table as long as queries do not contain types or expressions that are not supported by the vectorized engine. Queries are forcibly converted to vectorized execution plans for execution. In this case, the performance may deteriorate in different query scenarios.
- optimal: On the basis of force, the optimizer determines whether to convert a query statement into a vectorized execution plan based on the query complexity to avoid performance deterioration after the conversion.
Default value: off
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: Whether the optimizer uses a vectorized execution plan is affected. The query performance may be affected in some scenarios due to improper settings.
enable_opfusion_reuse
Parameter description: Specifies whether to reuse the opfusion obj memory.
Parameter type: Boolean.
Unit: none
Value range:
- on indicates that the opfusion obj memory is reused when conditions are met.
- off: This function is disabled.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is disabled, plans may be regenerated and the query performance may deteriorate.
enable_iud_fusion
Parameter description: Specifies whether to optimize the IUD statements.
Parameter type: Boolean.
Unit: none
Value range:
- on indicates that the input is optimized during type conversion.
- off: This function is disabled.
Default value: off
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value. You can enable this function if the IUD statement performance needs to be optimized.
Risks and impacts of improper settings: If this parameter is enabled, the optimizer cost increases without significant risk.
enable_cached_operator
Parameter description: Specifies whether to enable the cache feature for operators in execution state.
Parameter type: Boolean.
Unit: none
Value range:
- on: Operators can be executed in cache mode.
- off: This function is disabled.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is disabled, the operator execution status cannot be cached, affecting the query performance.
enable_smp_partitionwise
Parameter description: Specifies whether to enable the Partition-wise Join capability in the SMP scenario.
Parameter type: Boolean.
Unit: none
Value range:
- on: The Partition-wise Join capability is enabled in the SMP scenario.
- off: The Partition-wise Join capability is disabled in the SMP scenario.
Default value:
- on: default value of the newly installed database.
- off: This parameter is added in 505.2.0. If a database is upgraded from a version earlier than 505.2.0, the value of this parameter is off. If this parameter exists and is set before the upgrade, the default value remains unchanged after the upgrade.
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: The data query performance in the SMP scenario may be affected.
force_smp_partitionwise_scan
Parameter description: Specifies whether to enable the Partition-wise Scan parallel scan mode globally after the Partition-wise Join switch enable_smp_partitionwise is turned on in the SMP scenario.
Parameter type: Boolean.
Unit: none
Value range:
- on: The Partition-wise Scan parallel scan mode is enabled in the SMP scenario.
- off: The Partition-wise Scan parallel scan mode is disabled in the SMP scenario.
Default value: off
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: The performance of reading partitioned table data in the SMP scenario may be affected.
enable_nestagg
Parameter description: Specifies whether to enable nested aggregate function. Nested aggregation is a double aggregation syntax similar to sum(min(col)).
Parameter type: Boolean.
Unit: none
Value range:
- on: The nested aggregate function is enabled.
- off: The nested aggregate function is disabled.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: The nested aggregate function is affected.
enable_index_skip_scan
Parameter description: Specifies whether to enable the index skip scan feature. If this feature is disabled, a full table scan is performed when a user uses a composite index for query and the leading column is empty. If this feature is enabled, when a user uses a combination index for query and the leading column is empty, the database determines whether to perform index skip scanning based on the proportion of the number of distinct values (NDV). A lower proportion of NDV indicates greater advantage of index skip scan. When the proportion of the NDV is high, the cost of index skip scan may be higher than that of full table scan. As a result, the database still uses full table scan.
- Leading columns cannot be separated. For example, after an index is created for columns (a,b,c,d) of table t1, you cannot run the SELECT * FROM t1 WHERE b = xxx AND d = xxx statement for query.
- The leading columns cannot be a range.
- Expression indexes are not supported.
- Only RCR B-tree and UB-tree indexes are supported.
- Only IndexScan and IndexOnlyScan are supported. BitmapIndexScan is not supported.
- SQL Bypass is no longer evolved. Therefore, this feature does not apply to SQL Bypass.
- SMP is not supported.
- Hash bucket tables are not supported.
Parameter type: Boolean.
Unit: none
Value range:
- on: The index skip scan feature is enabled.
- off: The index skip scan feature is disabled.
Default value: off
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If the index skip scan feature is disabled, index scan cannot be used when a combination index is used for query and the leading column is empty. As a result, the query efficiency is reduced.
enable_gsi_stream_dml
Parameter description: Specifies whether to enable the stream feature for DML operations on base tables that have global secondary indexes.
Parameter type: Boolean.
Unit: none
Value range:
- on: The stream optimization is enabled for DML operations on base tables with global secondary indexes. That is, stream plans can be generated.
- off: The stream optimization is disabled for DML operations on base tables with global secondary indexes. That is, stream plans cannot be generated.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: If this parameter is disabled, the performance may deteriorate.
enable_partition_statistic
Parameter description: Specifies whether to use partition-level statistics in the optimizer phase. A scenario where partition-level statistics can be used is as follows: In a Cplan, the partitioned table involved in the query is statically pruned to a single partition, including pruning a partitioned table to a single partition.
Parameter type: Boolean.
Unit: none
Value range:
- on: Partition-level statistics can be used.
- off: Partition-level statistics cannot be used.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: The statistics of a partitioned table when the partitioned table is statically pruned to a single partition are affected, and the plan generation is affected.
dist_query_adaptive_mode
Parameter description: Specifies the mode selected by the distributed adaptive plan. The value can be auto (default), plan, sql, or off. If the parameter value is not off, the cost of the Remote Query operator is calculated.
Parameter type: enumerated type.
Unit: none
Value range:
- auto: The distributed plan is adaptively selected based on the cost or rule. If a rule exists (the dist_query_adaptive_rows parameter is not set to 0), the rule has a higher priority than cost-based selection.
- plan: The distributed plan of the delivered plan is forcibly executed.
- sql: The distributed plan of the delivered statement is forcibly executed.
- off: Adaptive selection of distributed plans is disabled.
Default value:
- auto: default value of the newly installed database.
- off: This parameter is introduced in 507.0.0. After an upgrade from an earlier version, the value of this parameter is off. If this parameter exists and has been set before the upgrade, the original value will be retained after the upgrade.
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: The optimizer's selection of the generation plan will be affected, and the query performance will be affected in some scenarios. Exercise caution when modifying the parameter to avoid risks caused by misoperations.
The process of adaptive selection of distributed plans is as follows: First, a distributed plan (stream plan) for the delivered plan is generated. By analyzing the characteristics of the stream plan, the system determines whether to trigger the adaptive selection of distributed plans. If adaptive optimization is required, a new distributed plan for the delivered statement is generated.
- Cost-based adaptive constraints on distributed plans:
- Only the SELECT statement supports adaptive selection of distributed plans.
- If a statement contains a stream hint, adaptive distributed optimization cannot be enabled for the plan.
- If a stream plan contains only the Stream Gather operator and no other stream operators, adaptive distributed optimization cannot be enabled for the plan.
- If a stream plan is an SMP plan, adaptive distributed optimization cannot be enabled for the plan.
- If a stream plan does not contain the join operation or related sublinks, adaptive distributed optimization cannot be enabled for the plan.
- If the cost of a stream plan is relatively low, adaptive distributed optimization cannot be enabled for the plan.
- When the memory or CPU usage of a CN is higher than 80%, if the distributed plan generated by the distributed adaptive plan for the delivered statement is a non-parameterized path plan, the system falls back to the stream plan. This constraint is controlled by the opt_behavior_knob option DIST_QUERY_ADAPTIVE_FALLBACK and is enabled by default.
- Rule-based adaptive constraints on distributed plans:
- Only the SELECT statement supports adaptive selection of distributed plans.
- If a statement contains a stream hint, adaptive distributed optimization cannot be enabled for the plan.
- If a stream plan contains only the Stream Gather operator and no other stream operators, adaptive distributed optimization cannot be enabled for the plan.
- If a stream plan is an SMP plan, adaptive distributed optimization cannot be enabled for the plan.
dist_query_adaptive_rows
Parameter description: Selects a distributed plan rule based on the number of rows of the stream operator. If the total number of rows of all stream operators (except the Stream Gather operator) is less than or equal to the value of this parameter, the distributed plan of the delivered statement is selected. If the total number of rows is greater than the value of this parameter, the distributed plan of the delivered plan is selected.
Parameter type: integer.
Unit: none
Value range: [0,2147483647]
Default value: 0 (indicating that the rule is disabled). This parameter is introduced in 507.0.0. After an upgrade from an earlier version, the value of this parameter is 0. If this parameter exists and has been set before the upgrade, the original value will be retained after the upgrade.
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Set this parameter when there are a large number of DNs. Adjust the value based on the service data scale. It is recommended that the value be less than or equal to 500.
Risks and impacts of improper settings: The optimizer's selection of the generation plan will be affected, and the query performance will be affected in some scenarios. Exercise caution when modifying the parameter to avoid risks caused by misoperations.
The Stream operator needs to establish connections with all DNs to transmit data. In scenarios with a large number of DNs and high concurrency, data communication bottlenecks may occur. Therefore, it is recommended that this parameter be used in services where the number of primary DNs in the cluster is greater than 8 and the number of concurrent requests is greater than 100. Before using this parameter, test and adjust its value based on service requirements.
enable_constraint_optimization
Parameter description: Specifies whether to enable the query optimization function based on informative constraints. When this function is enabled, the optimizer can use the constraint information on the table to generate a more efficient query execution plan. The main scenarios are as follows: external data source scan optimization, redundant NOT NULL constraint elimination, and scan and connection optimization that contain the UNIQUE constraint.
Parameter type: Boolean.
Unit: none
Value range:
- on: The query optimization function based on information constraints is enabled.
- off: The query optimization function based on information constraints is disabled.
Default value: on
Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Retain the default value.
Risks and impacts of improper settings: Improper settings may affect the query performance in some scenarios.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot