Note
This variable was introduced in OceanBase Database V4.3.1.
Description
query_rewrite_enabled specifies whether to enable query rewriting with materialized views.
Limitations
Query the variable
Global-level operation
In the
systenant or a user tenant, you can execute theSHOW VARIABLESstatement to query the variable at the global level or query theSYS.TENANT_VIRTUAL_GLOBAL_VARIABLE(in Oracle mode) orinformation_schema.GLOBAL_VARIABLES(in MySQL mode) view for the variable at the global level.Session-level operation
In the
systenant or a user tenant, you can execute theSHOW VARIABLESstatement to query the variable at the session level or query theSYS.TENANT_VIRTUAL_SESSION_VARIABLE(in Oracle mode) orinformation_schema.SESSION_VARIABLES(in MySQL mode) view for the variable at the session level.
Modify the variable
Set the variable at the global level
In the
systenant, you can directly change the value of the variable at the global level.In a MySQL user tenant, you must have the
SUPERorALTER SYSTEMprivilege to change the value of the variable at the global level.In OceanBase Database V4.2.0 and later V4.x versions, you must have the
ALTER SYSTEMprivilege to change the value of the variable at the global level in an Oracle user tenant.
Session-level operation
In the
systenant or a user tenant, you can directly change the value of the variable at the session level for the current tenant.
Attributes
| Attribute | Description |
|---|---|
| Type | ENUM |
| Default value | false |
| Value range | true, force, and false
|
| Effective scope |
|
| Modifiable | Yes. You can use the SET statement to modify the variable. |
Examples
Enable query rewriting with materialized views.
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;