Configuring Optimizer Parameters
This section introduces key CN parameters that affect optimization of SQL statements in GaussDB(DWS). For details about the parameter configuration method, see Configuring GUC Parameters.
Parameter/Reference Value |
Description |
||
---|---|---|---|
enable_nestloop=on |
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:
To temporarily change the value of this parameter in the current database connection (that is, the current session), run the following SQL statement:
By default, this parameter is set to on. Change the value as required. Generally, nested loop join has the poorest performance among the three JOIN methods (nested loop join, merge join, and hash join). You are advised to set this parameter to off. |
||
enable_bitmapscan=on |
Specifies whether the optimizer uses bitmap scanning. If the value is on, bitmap scanning 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), run the following SQL statements:
The bitmap scanning applies only in the query condition where a > 1 and b > 1 and indexes are created on columns a and b. During performance tuning, 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_fast_query_shipping=on |
Specifies whether the optimizer uses a distribution framework. If the value is on, the execution plan is generated on both CNs and DNs. If the value is off, the distribution framework is used, that is, the execution plan is generated on the CNs and then sent to DNs for execution.
NOTE:
To temporarily change the value of this parameter in the current database connection (that is, the current session), run the following SQL statement:
|
||
enable_hashagg=on |
Specifies whether to enable the optimizer's use of Hash-aggregation plan types. |
||
enable_hashjoin=on |
Specifies whether to enable the optimizer's use of Hash-join plan types. |
||
enable_mergejoin=on |
Specifies whether to enable the optimizer's use of Hash-merge plan types. |
||
enable_indexscan=on |
Specifies whether to enable the optimizer's use of index-scan plan types. |
||
enable_indexonlyscan=on |
Specifies whether to enable the optimizer's use of index-only-scan plan types. |
||
enable_seqscan=on |
Specifies whether the optimizer uses bitmap scanning. It is impossible to suppress sequential scans entirely, but setting this variable to off allows the optimizer to preferentially choose other methods if available. |
||
enable_sort=on |
Specifies the optimizer sorts. It is impossible to fully suppress explicit sorts, but setting this variable to off allows the optimizer to preferentially choose other methods if available. |
||
enable_broadcast=on |
Specifies whether enable the optimizer's use of data broadcast. In data broadcast, a large amount of data is transferred on the network. When the number of transmission nodes (stream) is large and the estimation is inaccurate, set this parameter to off and check whether the performance is improved. |
||
enable_redistribute=on This parameter is supported only by clusters of version 8.2.1.300 or later. |
Controls the query optimizer's use of data transmission in local redistribute and split redistribute redistribution modes. This parameter corresponds to enable_broadcast. The optimizer may overestimate the cost of local broadcast and split broadcast. As a result, the optimizer selects the local redistribute or split redistribute redistribution plan. This may cause performance deterioration. Therefore, when the actual data volume of the network transmission node (stream) is small, you can set this parameter to off so that the optimizer preferentially selects the broadcast mode. Then you can check whether the performance is improved. |
||
rewrite_rule |
Specifies whether the optimizer enables a specific rewriting rule. |
Feedback
Was this page helpful?
Provide feedbackThank 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