Semantic-Context Caching

Select AI can cache object context from catalog and MCP semantic sources. Caching reduces calls to external providers and provides consistent context across repeated requests.

Select AI maintains the cache separately for each semantic source. Authorized users can reuse cached context from a shared source.

Caching does not change database-object access requirements. Select AI verifies the requesting user’s access before retrieving cached or active object context.

Scope and Caching Support

Caching support depends on the semantic-source type and scope.

Source type Scope Object-context behavior Global-context behavior refresh_rate behavior
Catalog object or all Supports caching when cache is true Select AI retrieves global context for each request when the scope is all Specifies the interval for refreshing cached object context
Catalog global Not applicable Select AI retrieves global context for each request Does not control a global-context cache
Custom object, global, or all Select AI calls the object callback for each request Select AI calls the global callback for each request Does not control semantic-context caching
File global only Not applicable Select AI retrieves context from the file vector index Specifies the interval for the file-indexing pipeline
MCP object or all Supports caching when cache is true Select AI retrieves global context for each request when the scope is all Specifies the interval for refreshing cached object context
MCP global Not applicable Select AI retrieves global context for each request Does not control a global-context cache

Catalog and MCP sources use true as the default value of cache for object and all scope.

Custom and file sources do not support the semantic-source object cache. File sources support only global scope.

The package rejects unsupported combinations of source type, scope, cache, and refresh_rate.

See Common Attributes for the attribute definitions and default values.

Cache Population and Reuse

When Select AI needs object context that is not in the cache, it retrieves the context from the configured catalog or MCP source.

After a successful retrieval, Select AI stores the object context in the semantic source’s cache. Subsequent requests can reuse the cached context.

Users who have access to a shared semantic source can reuse its cached context. Select AI returns context only for database objects that each user can access.

Select AI does not cache global context. It retrieves global context for each natural-language request.

Custom callbacks also provide context for each request. File sources retrieve context from a vector index instead of the semantic-source object cache.

Cache Freshness and Retention

The refresh_rate attribute specifies a proactive refresh interval in minutes. The default value is 60 minutes.

refresh_rate is not a time-to-live value and does not define when cached context expires. Cached object context does not expire automatically after the configured interval.

Select AI can continue to use cached context until a scheduled or requested refresh replaces it, or until the source is dropped.

For cache-enabled catalog and MCP sources, a scheduled refresh updates object context already represented in the cache. Changes to external metadata become available after a successful refresh.

For file sources, refresh_rate controls the pipeline that checks and processes eligible files in the configured location. File sources do not use the object-context cache.

Refresh Cached Object Context

The source owner can request a refresh by using the DBMS_AI_SEM.REFRESH_SEMANTIC_SOURCE procedure.

A requested refresh:

The package reports an error if a scheduled or requested refresh is already in progress.

To reflect changed object metadata during automated object selection, reindex the object metadata in the automated object-list index.

See REFRESH_SEMANTIC_SOURCE Procedure for syntax, parameters, restrictions, and an example.

Refresh and Retrieval Failures

If a scheduled or requested refresh fails, Select AI retains the previously cached object context. Subsequent requests can continue to use that context.

When no cached entry exists, Select AI retrieves active object context from the configured provider. The Select AI request fails if active retrieval fails.

A retrieval failure from any enabled semantic source fails the entire Select AI request. Select AI does not return partial results from the remaining sources.

This behavior also applies to actions such as SHOWCONTEXT.

For source-specific request and response requirements, see Semantic Source Attributes.

Cached-Context Lifecycle

The following table describes how semantic-source lifecycle operations affect cached or indexed context.

Operation Catalog or MCP cached context File indexed content
Disable a source The database retains the cache, but Select AI does not use it while the source remains disabled The database retains the vector index and indexed data, but Select AI does not use the source
Re-enable a source Select AI can reuse the retained cache Select AI can reuse the retained indexed content
Update a source The database retains the existing cache; applicable changes appear after the next scheduled or requested refresh Applicable changes appear after the file-indexing pipeline processes the source
Detach a source from an AI profile The database retains the cache for other profiles that use the source The database retains the indexed content for other profiles that use the source
Drop a source The database removes the source and its cached context The database removes the source, vector index, pipeline, and indexed data

Disabling a source does not remove it from an AI profile. Select AI skips a disabled source and continues to use other enabled sources attached to the profile.

If an attached semantic source does not exist, the Select AI request fails.

Revoking a user’s access prevents that user from resolving or using the source. Revocation does not define the lifecycle of the source’s shared cache.

See DROP_SEMANTIC_SOURCE Procedure for source-removal requirements.