Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

Transactions - What are considered as Transaction in SQL Server

$
0
0
DECLARE @cntr_value bigint

SELECT @cntr_value = cntr_value
FROM sys.dm_os_performance_counters
WHERE counter_name LIKE 'Transactions/sec%'
AND instance_name LIKE '_Total%'

WAITFOR DELAY '00:00:10'

SELECT cntr_value - @cntr_value
FROM sys.dm_os_performance_counters
WHERE counter_name LIKE 'Transactions/sec%'
AND instance_name LIKE '_Total%'

I have been doing quite a bit of googling on " whats considered as one Transaction" , for example 

select * from Table with Million rows as well as select top 1 * from Table , Is both counted as one transaction?.

How does the TempDB/ Versioning / Triggers / Extended Events / WMI events, Service Broker Queues,etc counted in terms of Transaction counts?.

My question is " what constitutes as transaction"?.  Thanks for your help. If

Based on the Microsoft Definition,

SQL Server operates in the following transaction modes.

Autocommit transactions

Each individual statement is a transaction.

Explicit transactions

Each transaction is explicitly started with the BEGIN TRANSACTION statement and explicitly ended with a COMMIT or ROLLBACK statement.

Implicit transactions

A new transaction is implicitly started when the prior transaction completes, but each transaction is explicitly completed with a COMMIT or ROLLBACK statement.

Batch-scoped transactions

Applicable only to multiple active result sets (MARS), a Transact-SQL explicit or implicit transaction that starts under a MARS session becomes a batch-scoped transaction. A batch-scoped transaction that is not committed or rolled back when a batch completes is automatically rolled back by SQL Server.


I90Runner


Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>