Overview
ap_query_replica_fallback specifies whether a query will roll back to a non-columnar replica for execution when no columnar replica is available, if the automatic AP query routing feature is enabled.
Privilege requirements
Query variables
Global level
The
systenant and all user tenants can use theSHOW VARIABLESstatement and theinformation_schema.GLOBAL_VARIABLESview to view the values of global system variables.Session level
Both the
systenant and all user tenants can use theSHOW VARIABLESstatement and theinformation_schema.SESSION_VARIABLESview to view the values of session system variables.
Modify variables
Global effective
The
systenant can directly modify the values of global system variables.The user tenant must have the
SUPERorALTER SYSTEMprivilege to modify the value of a global system variable.
Session expiration
The
systenant and all user tenants can directly modify the values of session system variables for their own tenants.
Attributes
Attribute |
Description |
|---|---|
| Parameter type | Bool |
| Default Value | ON |
| Value range |
|
| Effective Scope |
|
| Modifiable | Yes, you can use theSETStatement modification. |
Usage instructions
The ap_query_replica_fallback variable controls whether a query will roll back to a non-columnar replica for execution when no available columnar replica is found during the automatic routing of an AP query.
- When set to
ON: When the AP/TP automatic routing feature is enabled, the optimizer checks whether a columnstore replica is available before generating a plan for a columnstore replica for an AP query. If any table involved in the query does not have an available columnstore replica, the optimizer will not generate a columnstore replica plan and will instead fall back to executing on a non-columnstore replica. - When set to
OFF: If the AP/TP automatic load balancing feature is enabled, the optimizer does not check the availability of columnstore replicas and directly generates a plan for the AP query on a columnstore replica. If the columnstore replica is unavailable, an error is returned during query execution.
This variable is used together with ap_query_route_policy. When ap_query_route_policy is set to OFF, this variable has no effect.
Configuration example
Set the value of ap_query_replica_fallback to ON.
Session expiration
obclient> SET ap_query_replica_fallback = ON;Effective globally
obclient> SET GLOBAL ap_query_replica_fallback = ON;