Purpose
You can use this statement to add a bound outline and throttling rules. This statement supports only outlines created by using SQL_TEXT.
Required privileges
To execute the ALTER OUTLINE statement, you must have the ALTER privilege. For more information about privileges in OceanBase Database, see Privilege types in MySQL mode.
Syntax
ALTER OUTLINE outline_name ADD stmt [ TO target_stmt ];
Parameters
| Parameter | Description |
|---|---|
| outline_name | The name of the outline to be modified. |
| stmt | It is generally a DML statement with hints and original parameters. |
| TO target_stmt | If TO target_stmt is not specified, when the parameterized SQL statement accepted by the database is the same as the parameterized text of stmt without a hint, the database binds the SQL statement to the hint in stmt to generate an execution plan. If you want to bind plans to statements that have hints, use TO target_stmt to specify the original SQL statement. Notice When you specify target_stmt, you must ensure that stmt exactly matches target_stmt after hints are removed. |
Examples
Execute
ALTER OUTLINEto add a throttling rule.obclient> ALTER OUTLINE ol_1 ADD SELECT /*+max_concurrent(1)*/ * FROM t1 WHERE c1 = 1 and c2 = ?; obclient> ALTER OUTLINE ol_1 ADD SELECT /*+max_concurrent(1)*/ * FROM t1 WHERE c1 = ? and c2 = 1;Execute
ALTER OUTLINEto add an execution plan.obclient> CREATE OUTLINE ol_2 ON SELECT /*+max_concurrent(1)*/ * FROM t1,t2 WHERE t1.c1 = 1; obclient> ALTER OUTLINE ol_2 ADD SELECT /*+use_nl(t2)*/ * FROM t1,t2 WHERE t1.c1 = 1;Execute
ALTER OUTLINEto add an execution plan and a throttling rule.obclient> ALTER OUTLINE ol_1 ADD SELECT /*++use_nl(t2) max_concurrent(1)*/ * FROM t1 WHERE c1 = 1 and c2 = ?; obclient> ALTER OUTLINE ol_1 ADD SELECT /*++use_nl(t2) max_concurrent(1)*/ * FROM t1 WHERE c1 = ? and c2 = 1;
Considerations
- Only one execution plan can be specified for an outline. If an execution plan has been specified by using the
CREATE OUTLINEstatement, you cannot add an execution plan again by executingALTER OUTLINE.