Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SQL Handles

Author  Topic 

dataflow
Starting Member

1 Post

Posted - 2013-01-07 : 10:04:24
Hello,

I'm looking for information on how SQL handles for database objects are generated.

According to Microsoft, "...database objects such as stored procedures, triggers or functions, the SQL handles are derived from the database ID, object ID, and object number."

Could anybody offer any more insight? Specifically, one thing I have noticed is that if a stored procedure is executed, a plan handle with a given SQL handle will be cached, and all subsequent plans for that procedure will have the same SQL handle, for as long as at least one of those plans remains in the cache. If all plans for a given SQL handle are cleared from the cache, and the same stored procedure (with the exact same text, object id, etc) is executed, the newly cached plan will have a different, but very similar, SQL handle.

I am curious what factor differentiates the SQL handle. According to my understanding, the SQL handles should be identical, but clearly that is not the case. Any insight would be greatly appreciated!

Thanks in advance :)
   

- Advertisement -