Note
This variable was introduced in V4.3.1.
Description
The query_rewrite_enabled variable specifies whether to enable materialized view-based query rewriting.
Privilege requirements
Query variables
Global level
Users of the
systenant and all user tenants can execute theSHOW VARIABLESstatement or view theSYS.TENANT_VIRTUAL_GLOBAL_VARIABLEview (Oracle mode) or theinformation_schema.GLOBAL_VARIABLESview (MySQL mode) to query the values of global system variables.Session level
Users of the
systenant and all user tenants can execute theSHOW VARIABLESstatement or view theSYS.TENANT_VIRTUAL_SESSION_VARIABLEview (Oracle mode) or theinformation_schema.SESSION_VARIABLESview (MySQL mode) to query the values of session system variables.
Modify variables
Set the variable at the global level
Users of the
systenant can directly modify the values of global system variables.MySQL users of user tenants need the
SUPERorALTER SYSTEMprivilege to modify the values of global system variables.For V4.x, Oracle users of user tenants need the
ALTER SYSTEMprivilege to modify the values of global system variables starting from V4.2.0.
Set the variable at the session level
Users of the
systenant and all user tenants can directly modify the values of session system variables in their own tenants.
Attributes
| Attribute | Description |
|---|---|
| Type | enum |
| Default value | false |
| Value range | [true, force, false]
|
| Effective scope |
|
| Modifiable | Yes. You can modify this variable by using the SET statement. |
Examples
The following examples show how to enable materialized view-based query rewriting.
Set the variable at the session level
obclient> SET query_rewrite_enabled= true;Set the variable at the global level
obclient> SET GLOBAL query_rewrite_enabled= true;