Note
This variable was introduced in V4.2.3 BP1.
Description
The plsql_optimize_level variable controls the optimization level for PL code compilation.
Privilege requirements
Query variables
Global level
Both the sys tenant and all user tenants can use the
SHOW VARIABLESstatement or the viewSYS.TENANT_VIRTUAL_GLOBAL_VARIABLE(Oracle-compatible mode) and the viewinformation_schema.GLOBAL_VARIABLES(MySQL-compatible mode) to view the values of global system variables.Session level
Both the sys tenant and all user tenants can use the
SHOW VARIABLESstatement or the viewSYS.TENANT_VIRTUAL_SESSION_VARIABLE(Oracle-compatible mode) and the viewinformation_schema.SESSION_VARIABLES(MySQL-compatible mode) to view the values of session system variables.
Modify variables
Global level
- The sys tenant can directly modify the values of global system variables.
- MySQL-compatible tenants need to have the
SUPERorALTER SYSTEMprivilege to modify the values of global system variables. - Oracle-compatible tenants need to have the
ALTER SYSTEMprivilege to modify the values of global system variables.
Session level
Both the sys tenant and all user tenants can directly modify the values of session system variables within their own tenant.
Attributes
| Attribute | Description |
|---|---|
| Parameter type | Int |
| Default value | 2 |
| Value range | [0,3]
|
| Scopes |
|
| Modifiable | Yes. It can be modified by using the SET statement. |
Considerations
Higher optimization levels mean more optimizations are performed by the compiler. We recommend that you set the plsql_optimize_level variable to 2. If you want more information, see Examples.
Examples
MySQL-compatible mode
Set the PL optimization level to
1at the global level to disable frontend optimization and enable backend optimization.obclient> SET GLOBAL plsql_optimize_level = 1;Set the PL optimization level to
2at the global level to enable frontend and backend optimization.obclient> SET GLOBAL plsql_optimize_level = 2;
Oracle-compatible mode
Set the PL optimization level to
1at the global level to disable frontend optimization and enable backend optimization.obclient> ALTER SYSTEM SET plsql_optimize_level = 1;Set the PL optimization level to
2at the global level to enable frontend and backend optimization.obclient> ALTER SYSTEM SET plsql_optimize_level = 2;