Thursday, March 22, 2012

Cursor - Structure of.

I wanted to know the internal workings of a 'cursor'.
What happens inside SQL Server from the time that it is declared, opened,
when it is used and finally closed and deallocated?
Have searched the web - but apart from examples and the pros/cons of using
them - have not come across the information that I want.
Can someone please provide this info to me or direct me to a site that has
this info?
Cheers!
SQLCatz.
I assume you are talking about Server side cursors?
This article might help you:
http://www.perftuning.com/_whitepape...ql_Cursors.pdf
Wei Xiao [MSFT]
SQL Server Storage Engine Development
http://blogs.msdn.com/weix
This posting is provided "AS IS" with no warranties, and confers no rights.
"SQLCatz" <SQLCatz@.discussions.microsoft.com> wrote in message
news:E6AAEB16-3DB5-422C-A106-0D7E49F24397@.microsoft.com...
>I wanted to know the internal workings of a 'cursor'.
> What happens inside SQL Server from the time that it is declared, opened,
> when it is used and finally closed and deallocated?
> Have searched the web - but apart from examples and the pros/cons of using
> them - have not come across the information that I want.
> Can someone please provide this info to me or direct me to a site that has
> this info?
> Cheers!
> SQLCatz.
|||Wei Xiao,
Thank you for the quick response!
But, this is not what I want.
MSSql_Cursors.pdf ~ There is much more information like this available on
SQL BOL. I want the internals.
Cheers!
SQLCatz.
"wei xiao [MSFT]" wrote:

> I assume you are talking about Server side cursors?
> This article might help you:
> http://www.perftuning.com/_whitepape...ql_Cursors.pdf
>
> --
> Wei Xiao [MSFT]
> SQL Server Storage Engine Development
> http://blogs.msdn.com/weix
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "SQLCatz" <SQLCatz@.discussions.microsoft.com> wrote in message
> news:E6AAEB16-3DB5-422C-A106-0D7E49F24397@.microsoft.com...
>
>
|||what specifically do you want to know?
It depends on the cursor type:
Declare cursor is just metadata operation.
static cursor is the most costly at open time, because the whole result is
generated during open. (async population makes it somewhat less a problem).
keyset requires population of the keys, so it is less expesive at open time.
Dynamic is even less expensive at oepn time, but more expensive at fetch
time. Not all cursor can be dynamic. it depends on the query.
--
Wei Xiao [MSFT]
SQL Server Storage Engine Development
http://blogs.msdn.com/weix
This posting is provided "AS IS" with no warranties, and confers no rights.
"SQLCatz" <SQLCatz@.discussions.microsoft.com> wrote in message
news:C634525C-5C5B-473A-B41A-CE4D7D22849C@.microsoft.com...[vbcol=seagreen]
> Wei Xiao,
> Thank you for the quick response!
> But, this is not what I want.
> MSSql_Cursors.pdf ~ There is much more information like this available on
> SQL BOL. I want the internals.
> Cheers!
> SQLCatz.
> "wei xiao [MSFT]" wrote:
rights.[vbcol=seagreen]
opened,[vbcol=seagreen]
using[vbcol=seagreen]
has[vbcol=seagreen]

No comments:

Post a Comment