Oracle 参数 RESULT_CACHE_MODE 官方解释,作用,如何配置最优化建议

本站中文解释

参数

RESULT_CACHE_MODE参数是Oracle数据库中控制Oracle能够缓存查询结果集的参数。它有四个可用值:FORCE、MANUAL、DEMAND和OFF。

– FORCE:强制Oracle强制缓存查询结果。
– MANUAL:允许Oracle缓存查询结果,但是需要用户要求Oracle缓存。
– DEMAND:若Oracle发现启用了RESULT_CACHE_MODE参数,且查询执行计划为查询结果可缓存时,则Oracle会自动缓存查询结果。
– OFF:禁用 Oracle 缓存查询结果。

RESULT_CACHE_MODE参数默认值为 MANUAL,也可以调整为FORCE或者DEMAND,以达到查询优化的目的,但是并不能显著提升性能,因此建议在设置此参数前,应该先分析当前系统的查询对性能的影响,以此来判断此参数是否有必要调整。

官方英文解释

RESULT_CACHE_MODE specifies which queries are eligible to store result sets in the result cache. Only query execution plans with the result cache operator will attempt to read from or write to the result cache.

Property Description

Parameter type

String

Syntax

RESULT_CACHE_MODE = { MANUAL | MANUAL_TEMP | FORCE | FORCE_TEMP }

Default value

MANUAL

Modifiable

ALTER SESSION, ALTER SYSTEM

Modifiable in a PDB

Yes

Basic

No

Oracle RAC

Multiple instances can have different values.

Values

  • MANUAL

    Query results can only be stored in the result cache by using a query hint or table annotation.

  • MANUAL_TEMP

    Query results can only be stored in the result cache by using a query hint or table annotation. All hinted queries are allowed to leverage temporary segments on disk unless explicitly prohibited by using the /*+ RESULT_CACHE (TEMP=FALSE) */ hint.

  • FORCE

    All query results are stored in the result cache. If a query result is not in the cache, then the database executes the query and stores the result in the cache. Subsequent executions of the same SQL statement that include the /*+ RESULT_CACHE */ hint will retrieve data from the cache. Sessions will use these results, if possible. To exclude query results from the cache, use the /*+ NO_RESULT_CACHE */ hint.

  • FORCE_TEMP

    All query results are stored in the result cache. All queries are allowed to leverage temporary segments on disk unless explicitly prohibited by a hint.

Note:

The FORCE and FORCE_TEMP modes are not generally recommended because queries that call non-deterministic PL/SQL functions are cached, potentially causing material changes to the results. Enabling the result cache in such a broad-based manner can also impact performance in mixed workload environments, where the same tables are continuously updated and retrieved.

See Also:

  • Oracle Database SQL Tuning
    Guide
    for more information on how the result cache handles PL/SQL functions before changing the value of this initialization parameter

  • Oracle Database SQL
    Language Reference
    for more information about the NO_RESULT_CACHE hint


数据运维技术 » Oracle 参数 RESULT_CACHE_MODE 官方解释,作用,如何配置最优化建议