Sunday, March 25, 2012

Can we actually restrict granularity of locking

Say if i want a rowlock or a paglock, will SQL Server actually grant that ?
Or are there circumstances that no SQL may override that and grab a higher
lock if it deems fit ?
ThanksYou can use Hints to ask for the granularity you want, but it is not 100%
guaranteed. If you ask for tablock for example, and someone has a rowlock on
another row, you won't get the tablock.
You can also restrict lock granularity by using sp_indexoption. Read about
it in BOL.
--
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Hassan" <fatima_ja@.hotmail.com> wrote in message
news:e514chVFFHA.2564@.tk2msftngp13.phx.gbl...
> Say if i want a rowlock or a paglock, will SQL Server actually grant that
> ?
> Or are there circumstances that no SQL may override that and grab a higher
> lock if it deems fit ?
> Thanks
>|||"If you ask for tablock for example, and someone has a rowlock on another
row, you won't get the tablock"..
Could you elaborate more on this ? What lock would i get then ?
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:Or72dWXFFHA.1936@.TK2MSFTNGP14.phx.gbl...
> You can use Hints to ask for the granularity you want, but it is not 100%
> guaranteed. If you ask for tablock for example, and someone has a rowlock
on
> another row, you won't get the tablock.
> You can also restrict lock granularity by using sp_indexoption. Read about
> it in BOL.
> --
> HTH
> --
> Kalen Delaney
> SQL Server MVP
> www.SolidQualityLearning.com
>
> "Hassan" <fatima_ja@.hotmail.com> wrote in message
> news:e514chVFFHA.2564@.tk2msftngp13.phx.gbl...
> > Say if i want a rowlock or a paglock, will SQL Server actually grant
that
> > ?
> > Or are there circumstances that no SQL may override that and grab a
higher
> > lock if it deems fit ?
> >
> > Thanks
> >
> >
>|||"Hassan" <fatima_ja@.hotmail.com> schrieb im Newsbeitrag
news:OF5uF7ZFFHA.2564@.tk2msftngp13.phx.gbl...
> "If you ask for tablock for example, and someone has a rowlock on
another
> row, you won't get the tablock"..
> Could you elaborate more on this ? What lock would i get then ?
From common sense I'd assume that you'll get the most granular lock that
doesn't conflict.
robert
> "Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
> news:Or72dWXFFHA.1936@.TK2MSFTNGP14.phx.gbl...
> > You can use Hints to ask for the granularity you want, but it is not
100%
> > guaranteed. If you ask for tablock for example, and someone has a
rowlock
> on
> > another row, you won't get the tablock.
> >
> > You can also restrict lock granularity by using sp_indexoption. Read
about
> > it in BOL.
> >
> > --
> > HTH
> > --
> > Kalen Delaney
> > SQL Server MVP
> > www.SolidQualityLearning.com
> >
> >
> > "Hassan" <fatima_ja@.hotmail.com> wrote in message
> > news:e514chVFFHA.2564@.tk2msftngp13.phx.gbl...
> > > Say if i want a rowlock or a paglock, will SQL Server actually grant
> that
> > > ?
> > > Or are there circumstances that no SQL may override that and grab a
> higher
> > > lock if it deems fit ?
> > >
> > > Thanks
> > >
> > >
> >
> >
>

No comments:

Post a Comment