Skip to main content
Version: V1.0.0

FLUSH PLAN CACHE

Description

This statement is used to clear the plan cache for a specified database and SQL ID.

Syntax

ALTER SYSTEM FLUSH PLAN CACHE
[
[SQL_identifier] [database_list]
] [GLOBAL]

database_list:
databases ='database_name, database_name...'

Parameter Description

ParameterDescription
SQL_identifierSpecifies the SQL statement in the format sql_id = 'xxx'. If this parameter is not specified, the plan cache for all SQL statements will be cleared.
database_listSpecifies the database. If this parameter is not specified, the plan cache for all databases will be cleared.
GLOBALAn optional parameter. If this parameter is not specified, the plan cache for the local node will be cleared.

Examples

  • Clear the plan cache for all databases.

    ALTER SYSTEM FLUSH PLAN CACHE;
    Query OK, 0 rows affected
  • Clear the plan cache for a specified database and SQL ID.

    ALTER SYSTEM FLUSH PLAN CACHE sql_id='B601070DFC14CB85FDA3766A69A9E1B3'
    databases='myob1' GLOBAL;
    Query OK, 0 rows affected