---
title: "sys.syscacheobjects (Transact-SQL)"
description: "sys.syscacheobjects (Transact-SQL)"
author: rwestMSFT
ms.author: randolphwest
ms.date: "06/10/2016"
ms.service: sql
ms.subservice: system-objects
ms.topic: "reference"
f1_keywords:
- "sys.syscacheobjects_TSQL"
- "sys.syscacheobjects"
- "syscacheobjects"
- "syscacheobjects_TSQL"
helpviewer_keywords:
- "syscacheobjects system table"
- "sys.syscacheobjects compatibility view"
dev_langs:
- "TSQL"
---
# sys.syscacheobjects (Transact-SQL)
[!INCLUDE [SQL Server](../../includes/applies-to-version/sqlserver.md)]
Contains information about how the cache is used.
> [!IMPORTANT]
> [!INCLUDE[ssnoteCompView](../../includes/ssnotecompview-md.md)]
|Column name|Data type|Description|
|-----------------|---------------|-----------------|
|**bucketid**|**int**|Bucket ID. Value indicates a range from 0 through (directory size - 1). Directory size is the size of the hash table.|
|**cacheobjtype**|**nvarchar(17)**|Type of object in the cache:
Compiled plan
Executable plan
Parse tree
Cursor
Extended stored procedure|
|**objtype**|**nvarchar(8)**|Type of object:
Stored procedure
Prepared statement
Ad hoc query ([!INCLUDE[tsql](../../includes/tsql-md.md)] 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|
|**objid**|**int**|One 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.|
|**dbid**|**smallint**|Database ID in which the cache object was compiled.|
|**dbidexec**|**smallint**|Database 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**.|
|**uid**|**smallint**|Indicates 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.|
|**refcounts**|**int**|Number of other cache objects referencing this cache object. A count of 1 is the base.|
|**usecounts**|**int**|Number of times this cache object has been used since inception.|
|**pagesused**|**int**|Number of pages consumed by the cache object.|
|**setopts**|**int**|SET 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**|
|**langid**|**smallint**|Language ID. ID of the language of the connection that created the cache object.|
|**dateformat**|**smallint**|Date format of the connection that created the cache object.|
|**status**|**int**|Indicates whether the cache object is a cursor plan. Currently, only the least significant bit is used.|
|**lasttime**|**bigint**|For backward compatibility only. Always returns 0.|
|**maxexectime**|**bigint**|For backward compatibility only. Always returns 0.|
|**avgexectime**|**bigint**|For backward compatibility only. Always returns 0.|
|**lastreads**|**bigint**|For backward compatibility only. Always returns 0.|
|**lastwrites**|**bigint**|For backward compatibility only. Always returns 0.|
|**sqlbytes**|**int**|Length in bytes of the procedure definition or batch submitted.|
|**sql**|**nvarchar(3900)**|Module definition or the first 3900 characters of the batch submitted.|
## See Also
[Compatibility Views (Transact-SQL)](~/relational-databases/system-compatibility-views/system-compatibility-views-transact-sql.md)