Other Optimizer Options
The quality of a query plan directly affects the SQL execution performance. Settings such as statistics sampling, planning constraints, degree of parallelism, and inter-node communication mode affect the selection of query plans. This section describes other optimizer options, including the statistics sampling target (default_statistics_target), planning collapse limits (from_collapse_limit and join_collapse_limit), SMP and actor parallelism (query_dop and fq_query_vdn), and inter-node communication mode (enable_libcomm). You can adjust these parameters based on the data scale and service load to improve the accuracy and execution efficiency of query plans.
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| default_statistics_target | Float | Definition: Specifies the default statistics target for tables that have not had a statistics target set for any column with ALTER TABLE SET STATISTICS. If this parameter is set to a positive number, it indicates the number of samples for statistics. If this parameter is set to a negative number, it indicates that the statistics target is set in percentage. The negative number is converted to the corresponding percentage. For example, -5 indicates 5%. During sampling, the value of default_statistics_target multiplied by 300 is used as the size of random sampling. For example, if the default value is 100, 30,000 pages are randomly read and 30,000 data records are randomly selected from the pages to complete random sampling. Range: A floating point number ranging from –100 to 10,000. NOTE:
Default Value: 100. |
| from_collapse_limit | Integer | Definition: Specifies whether the optimizer merges subqueries into upper-level queries based on the number of items in the generated FROM list. If the number of items in the FROM list is less than or equal to this value, the optimizer merges subqueries into upper-level queries. Range: An integer, in the range [1, INT_MAX]. NOTE: Smaller values reduce planning time but may lead to inferior execution plans. Default Value: 8. |
| join_collapse_limit | Integer | Definition: Specifies whether the optimizer rewrites the JOIN constructs except FULL JOINS into the FROM list based on the number of items in the list. Range: An integer, in the range [1, INT_MAX]. NOTE:
Default Value: 8. |
| enable_libcomm | Boolean | Definition: Specifies whether DNs communicate with each other through libcomm. Range: Boolean.
Default Value: off. |
| enable_bloom_filter | Boolean | Definition: Specifies whether BloomFilter optimization is allowed. This function is applicable to scenarios where a HASH JOIN on the foreign table side, which includes HDFS internal/foreign tables or column-store tables in the same thread, triggers the Bloom Filter optimization. Constraints:
Range: Boolean.
Default Value: None. |
| enable_extrapolation_stats | Boolean | Definition: Specifies whether to allow the use of inference-based estimation logic based on historical statistics. Using this logic can increase the possibility of accurate estimation for tables whose statistics are not collected in time. However, there is also a possibility that the estimation is too large due to incorrect inference. Range: Boolean.
Default Value: off. |
| query_dop | Integer | Definition: Specifies the user-defined query parallelism. Range: An integer, in the range [–64, 64].
Default Value: 1. |
| smp_thread_cost | Float | Definition: Specifies the minimum estimated cost that each SMP thread should carry when planning the degree of parallelism in the SMP adaptive scenario. If the estimated cost of an operator is low but the degree of parallelism is high, causing the estimated cost calculated by each SMP thread to be less than this threshold, the optimizer automatically reduces the degree of parallelism of the operator. This prevents system resources from being wasted by enabling a high degree of parallelism for low-cost operators. Range: A floating point number, in the range [0, 10000].
NOTE: If this parameter is not set to 0 and the estimated cost of an operator is too small, the degree of parallelism in SMP is low. In this case, you can set this parameter to 0 to increase the degree of parallelism. Default Value: 1000. |
| plan_mode_seed | Integer | Definition: This parameter is a debug parameter. It controls whether the optimizer uses the dynamic programming algorithm to estimate the optimal execution plan or generates a random plan. Parameter type: USERSET. Range: An integer, in the range [–1, 2147483647].
NOTE:
Default Value: 0. |
| fq_query_vdn | Integer | Definition: Specifies the number of actors that can be started for a task. Range: An integer, in the range [0, 256].
Default Value: 2. |
| fq_actor_adapt_type | Enum | Definition: Specifies the mode in which actors are started adaptively. Range: Enumerated values.
NOTE: This parameter only takes effect when actor count adaptation is enabled (that is, fq_query_vdn = 0). Default Value: mem. |
| fq_dynamic_actor_cost_threshold | Float | Definition: Specifies the threshold of the single-CN cost when fq_query_vdn is set to 0. If the threshold is exceeded, the actor is started. Range: A floating point number, in the range [1, 1e10]. Default Value: 200000. NOTE: During adaptation, the number of selected actors and the cost are not in a simple linear relationship. Instead, they are in a process of gradient descent. As the cost increases, the number of selected actors tends to 256. |
| objref_transfer_options | String | Definition: Specifies the settings related to big data transfer. The parameter value is a string of comma-separated key-value pairs, with each pair in the format of (key:value). This parameter takes effect only when objectref_transfer is set in sql_opt_options. Range: A string of key-value pairs.
Default Value: (release_batch_threshold:16),(width_threshold:0). Example: set objref_transfer_options = "(release_batch_threshold:16),(width_threshold:0)"; |
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