Read Parameters of the Standby Node in a Distributed System
enable_standby_read
Parameter description: Specifies whether to enable the read function of the standby node for a session.

This function can be enabled only in GTM-free, GTM-lite, non-standby cluster for DR, non-transaction block, and hot-standby modes.
Parameter type: Boolean.
Unit: none
Value range:
- on: The read function of the standby node in a distributed system is enabled for the session.
- off: The read function of the standby node in a distributed system is disabled for the session.
Default value: off
Setting method: This parameter is a USERSET parameter and can be set only at the session level (enable_standby_read is set to on). It cannot be set using gs_guc set/reload.
Setting suggestion: This parameter cannot be set using gs_guc. If you need to query the standby node, enable it in the session.
Risks and impacts of improper settings: If this parameter is set at a non-session level (for example, enabling this parameter in the configuration file), the cluster cannot be started when a parameter conflict occurs. If no parameter conflict occurs, the read function of the standby node in a distributed system is also enabled for backend threads such as autovacuum and WorkloadMonitor. As a result, DDL and DML operations are affected and errors are reported.
enable_direct_standby_datanodes
Parameter description: Specifies whether to enable the EXECUTE DIRECT ON extension capability for a session. If this parameter is enabled, the EXECUTE DIRECT ON statement can be used to connect to any standby DN or all standby DNs in a shard to execute queries. For details about the execute direct on syntax, see "SQL Reference > SQL Syntax > E > EXECUTE DIRECT" in Developer Guide.

- This function can be enabled only in GTM-free mode, non-transaction block, and hot-standby mode.
- In the same session, an error is reported if enable_direct_standby_datanodes is set to on after enable_standby_read is set to on. An error is also reported if enable_standby_read is set to on after enable_direct_standby_datanodes is set to on.
- After this parameter is enabled, the current session is read-only, and DDL and DML jobs are affected and errors are reported.
- After this parameter is enabled, you can use EXECUTE DIRECT ON to query only system DFX information such as system views, system functions, and system catalogs. Common user tables cannot be queried.
- After the enable_direct_standby_datanodes parameter is enabled, EXECUTE DIRECT ON supports distributed standby node query. Before using this function during the upgrade, ensure that the CN and DN instance processes have been replaced with the latest binary files. Otherwise, packet verification fails and an error is reported.
Parameter type: Boolean.
Unit: none
Value range:
- on: The EXECUTE DIRECT ON extension capability is enabled for the session.
- off: The EXECUTE DIRECT ON extension capability is disabled for the session.
Default value: off
Setting method: This parameter is a USERSET parameter and can be set only at the session level (enable_direct_standby_datanodes is set to on). It cannot be set using gs_guc set/reload.
Setting suggestion: This parameter is used to specify whether to enable EXECUTE DIRECT ON to perform the connection behavior in the distributed standby node read scenario. This function is mainly used for WDR, database test, and O&M. You are advised not to enable this function in other scenarios. This parameter cannot be set using gs_guc. If you need to query the standby node, enable it in the session.
Risks and impacts of improper settings: If this parameter is enabled in the configuration file, the database node cannot be started.
standby_read_delay
Parameter description: Specifies the maximum difference between the primary and standby nodes when data is read from the standby node. If the difference exceeds the value of this parameter, data cannot be read from the standby node.
Parameter type: integer.
Unit: ms
Value range: –1 to 2147483647
- –1: The difference between the primary and standby nodes does not need to be verified when data is read from the standby node.
- 0: Data can be read from the standby node only when there is no difference between the primary and standby nodes.
Default value: 10000000
Setting method: This is a SIGHUP parameter. Set it based on instructions provided in Table 1. For example, if this parameter is set to 86400 without a unit, it indicates 86400 ms. If this parameter is set to 1d, it indicates 1 day. The unit must be ms, s, min, h, or d if required.
Setting suggestion: Set this parameter based on service requirements.
Risks and impacts of improper settings: Change the parameter value after you fully understand the parameter meaning and test the parameter.
standby_read_rto
Parameter description: Specifies the maximum RTO of the system when data is read from the standby node. If the RTO exceeds the value of this parameter, data cannot be read from the standby node.
Parameter type: integer.
Unit: ms
Value range: –1 to 2147483647
- –1: The system RTO does not need to be verified when data is read from the standby node.
- 0: Data can be read from the standby node only when the RTO of at least one standby node is 0.
Default value: 60000
Setting method: This is a SIGHUP parameter. Set it based on instructions provided in Table 1. For example, if this parameter is set to 86400 without a unit, it indicates 86400 ms. If this parameter is set to 1d, it indicates 1 day. The unit must be ms, s, min, h, or d if required.
Setting suggestion: Set this parameter based on service requirements.
Risks and impacts of improper settings: Change the parameter value after you fully understand the parameter meaning and test the parameter.
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