Configuring Key Parameters for SQL Optimization
This section describes key configuration parameters of the primary database node, which affect GaussDB SQL optimization. Contact an administrator to configure parameters.
Parameter/Reference Value |
Description |
||
---|---|---|---|
enable_nestloop=off |
Specifies how the optimizer uses Nest Loop Join. If this parameter is set to on, the optimizer preferentially uses Nest Loop Join. If it is set to off, the optimizer preferentially uses other methods, if any.
NOTE:
If you only want to temporarily change the value of this parameter during the current database connection (that is, the current session), execute the following SQL statement:
Disabling this parameter does not affect the index nested-loop join operator (corresponding to the enable_index_nestloop parameter). During real-world optimization, it is important to assess whether to disable this parameter based on the specific circumstances. Three types of joins are supported: nested loops, merge joins, and hash joins. Specifically, nested loops are best suited for scenarios with small data volumes or indexes, while hash joins are ideal for big data analysis. |
||
enable_index_nestloop=on |
Specifies whether to enable the index nested-loop join operator.
NOTE:
If you only want to temporarily change the value of this parameter during the current database connection (that is, the current session), execute the following SQL statement:
Differences between enable_index_nestloop and enable_nestloop: enable_index_nestloop helps manage scenarios where the inner table undergoes index scans, and the outer table supplies index condition parameters for the inner table. |
||
enable_bitmapscan=on |
Specifies whether the optimizer uses bitmap scan. If the value is on, bitmap scan is used. If the value is off, it is not used.
NOTE:
If you only want to temporarily change the value of this parameter during the current database connection (that is, the current session), execute the following SQL statement:
The bitmap scan applies only in the query condition where a > 1 and b > 1 and indexes are created on columns a and b. However, the performance of bitmapscan is sometimes inferior to that of indexscan. During optimization, if the query performance is poor and bitmapscan operators are in the execution plan, set this parameter to off and check whether the performance is improved. |
||
enable_hashagg=on |
Specifies whether the optimizer uses hash aggregate plans. |
||
enable_hashjoin=on |
Specifies whether the optimizer uses hash join plans. |
||
enable_mergejoin=on |
Specifies whether the optimizer uses merge join plans. |
||
enable_indexscan=on |
Specifies whether the optimizer uses index scan plans. |
||
enable_indexonlyscan=on |
Specifies whether the optimizer uses index-only scan plans. |
||
enable_seqscan=on |
Specifies whether the optimizer uses sequential scan plans. It is impossible to suppress sequential scans entirely, but setting this variable to off encourages the optimizer to choose other methods if available. |
||
enable_sort=on |
Specifies the optimizer sorting order. It is impossible to fully suppress explicit sorting, but setting this variable to off encourages the optimizer to choose other methods if available. |
||
rewrite_rule |
Specifies whether the optimizer enables the LAZYAGG, MAGICSET, PARTIALPUSH, DISABLEREP, UNIQUECHECK, INTARGETLIST, PREDPUSH, PREDPUSHFORCE, PREDPUSHNORMAL, DISABLE_PULLUP_EXPR_SUBLINK, ENABLE_SUBLINK_PULLUP_ENHANCED, DISABLE_PULLUP_NOT_IN_SUBLINK, DISABLE_ROWNUM_PUSHDOWN, DISABLE_WINDOWAGG_PUSHDOWN rewriting, or GROUPBY_PUSHDOWN_SUBQUERY rule. |
||
sql_beta_feature |
Specifies whether the optimizer enables the SEL_SEMI_POISSON, SEL_EXPR_INSTR, PARAM_PATH_GEN, RAND_COST_OPT, PARAM_PATH_OPT, PAGE_EST_OPT, CANONICAL_PATHKEY, PREDPUSH_SAME_LEVEL, PARTITION_FDW_ON, DISABLE_BITMAP_COST_WITH_LOSSY_PAGES, ENABLE_UPSERT_EXECUTE_GPLAN, or DISABLE_FASTPATH_INSERT beta feature. |
||
var_eq_const_selectivity |
Specifies whether the optimizer uses histograms to calculate the selectivity of integer constants. |
||
partition_page_estimation |
Specifies whether to optimize page estimation of partitioned table pages based on the pruning result. Only the partitioned table pages and local index pages are included. The global index pages are not included. The estimation formula is as follows: Number of pages after estimation = Total number of pages in the partitioned table x (Number of partitions after pruning/Total number of partitions) |
||
partition_iterator_elimination |
Specifies whether to eliminate the partition iteration operators to improve execution efficiency when the partition pruning result of a partitioned table is a partition. |
||
enable_functional_dependency |
Specifies whether functional dependency statistics are used. Setting this parameter to on will enable the following functions:
Setting this parameter to off will disable the following functions:
NOTE:
The concept of functional dependency comes from the relational database normal form, which indicates the functional relationship between attributes. The concept of functional dependency statistics derives from the preceding concept. It indicates the ratio of the data volume that meets the functional relationship to the total data volume. Functional dependency statistics are a type of multi-column statistics, which can be used to improve the accuracy of selectivity estimation. Functional dependency statistics are applicable to the where a = 1 and b = 1 condition, in which a and b must be attributes of the same table subject to equivalent constraints and the constraints are connected by AND. There are at least two constraints. |
||
enable_seqscan_fusion |
Specifies whether to enable the sequential scan noise floor elimination function. |
||
enable_inner_unique_opt |
Specifies whether the optimizer uses Inner Unique. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.