Sunday, February 19, 2012

Implicit queries

Implicit queries seem to increase locks. I was wondering
why?
ThanksWhat exactly do you mean by "Implicit queries"?
--
Andrew J. Kelly
SQL Server MVP
"Jay Kay" <jeelanik@.yahoo.com> wrote in message
news:08ff01c38911$5050fc80$a101280a@.phx.gbl...
> Implicit queries seem to increase locks. I was wondering
> why?
> Thanks|||Andrew,
Explicit transacitons are started with "BEGIN TRANSACTION" and end when the
transaction is either committed or rolled back, therefore the lock is held
for only that period.
Implicit Transactions
When a connection is operating in implicit transaction mode, Microsoft=AE SQL
ServerT automatically starts a new transaction after the current transaction
is committed or rolled back. You do nothing to delineate the start of a
transaction; you only commit or roll back each transaction. Implicit
transaction mode generates a continuous chain of transactions.
Thanks.
>--Original Message--
>What exactly do you mean by "Implicit queries"?
>-- >Andrew J. Kelly
>SQL Server MVP
>
>"Jay Kay" <jeelanik@.yahoo.com> wrote in message
>news:08ff01c38911$5050fc80$a101280a@.phx.gbl...
>> Implicit queries seem to increase locks. I was wondering
>> why?
>> Thanks
>
>.
>|||I know what Implicit Transactions are but you said Queries and I wasn't sure
that is what you meant.
Usually when you use Explicit trans your transactions are short and you only
have code in between the Begin and Commit that absolutely needs to be there.
What I see a lot with Implicit trans are that there is a lot of extra
statements that get "caught up " in the transaction that really don't need
to be there. Any extra statements increases the time it takes and also the
possibility of more locks simply because there is more being executed inside
the actual tran. One other thing you can look at is to see what the
isolation level is set to when the Implicit tran begins. Some clients
default to Serializable and that will definitely cause more locks.
--
Andrew J. Kelly
SQL Server MVP
"Jay Kay" <jeelanik@.yahoo.com> wrote in message
news:1f46a01c389cf$22b5c800$a601280a@.phx.gbl...
Andrew,
Explicit transacitons are started with "BEGIN
TRANSACTION" and end when
the
transaction is either committed or rolled back, therefore
the lock is
held
for only that period.
Implicit Transactions
When a connection is operating in implicit transaction
mode, Microsoft®
SQL
ServerT automatically starts a new transaction after the
current
transaction
is committed or rolled back. You do nothing to delineate
the start of a
transaction; you only commit or roll back each
transaction. Implicit
transaction mode generates a continuous chain of
transactions.
Thanks.
>--Original Message--
>What exactly do you mean by "Implicit queries"?
>--
>Andrew J. Kelly
>SQL Server MVP
>
>"Jay Kay" <jeelanik@.yahoo.com> wrote in message
>news:08ff01c38911$5050fc80$a101280a@.phx.gbl...
>> Implicit queries seem to increase locks. I was
wondering
>> why?
>> Thanks
>
>.
>

No comments:

Post a Comment