sys.syscacheobjects (Transact-SQL)

 

Updated: June 10, 2016

Contains information about how the cache is used.

System_CAPS_ICON_important.jpg Important


This SQL Server 2000 system table is included as a view for backward compatibility. We recommend that you use the current SQL Server system views instead. To find the equivalent system view or views, see Mapping System Tables to System Views (Transact-SQL). This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

Applies to: SQL Server (SQL Server 2008 through current version).
Column nameData typeDescription
bucketidintBucket ID. Value indicates a range from 0 through (directory size - 1). Directory size is the size of the hash table.
cacheobjtypenvarchar(17)Type of object in the cache:

Compiled plan

Executable plan

Parse tree

Cursor

Extended stored procedure
objtypenvarchar(8)Type of object:

Stored procedure

Prepared statement

Ad hoc query (Transact-SQL submitted as language events from the sqlcmd or osql utilities, instead of remote procedure calls)

ReplProc (replication procedure)

Trigger

View

Default

User table

System table

Check

Rule
objidintOne of the main keys used for looking up an object in the cache. This is the object ID stored in sysobjects for database objects (procedures, views, triggers, and so on). For cache objects such as ad hoc or prepared SQL, objid is an internally generated value.
dbidsmallintDatabase ID in which the cache object was compiled.
dbidexecsmallintDatabase ID from which the query is executed.

For most objects, dbidexec has the same value as dbid.

For system views, dbidexec is the database ID from which the query is executed.

For ad hoc queries, dbidexec is 0. This means dbidexec has the same value as dbid.
uidsmallintIndicates the creator of the plan for ad hoc query plans and prepared plans.

-2 = The batch submitted does not depend on implicit name resolution and can be shared among different users. This is the preferred method. Any other value represents the user ID of the user submitting the query in the database.

Overflows or returns NULL if the number of users and roles exceeds 32,767.
refcountsintNumber of other cache objects referencing this cache object. A count of 1 is the base.
usecountsintNumber of times this cache object has been used since inception.
pagesusedintNumber of pages consumed by the cache object.
setoptsintSET option settings that affect a compiled plan. These settings are part of the cache key. Changes to values in this column indicate users have modified SET options. These options include the following:

 ANSI_PADDING

 FORCEPLAN

 CONCAT_NULL_YIELDS_NULL

 ANSI_WARNINGS

 ANSI_NULLS

 QUOTED_IDENTIFIER

 ANSI_NULL_DFLT_ON

 ANSI_NULL_DFLT_OFF
langidsmallintLanguage ID. ID of the language of the connection that created the cache object.
dateformatsmallintDate format of the connection that created the cache object.
statusintIndicates whether the cache object is a cursor plan. Currently, only the least significant bit is used.
lasttimebigintFor backward compatibility only. Always returns 0.
maxexectimebigintFor backward compatibility only. Always returns 0.
avgexectimebigintFor backward compatibility only. Always returns 0.
lastreadsbigintFor backward compatibility only. Always returns 0.
lastwritesbigintFor backward compatibility only. Always returns 0.
sqlbytesintLength in bytes of the procedure definition or batch submitted.
sqlnvarchar(3900)Module definition or the first 3900 characters of the batch submitted.

Compatibility Views (Transact-SQL)

Community Additions

ADD
Show: