In this post I'm going to talk about locks on SQL Server. Locks are necessary, they are used in all operations in the database. Don't get confused about blocking, locking and blocking are totally different. When we talk about lock, doing something in the database, like an update and select though will cause a type … Continue reading Locks everywhere
I was talking with a friend about how a database works and she asked me to explain transaction isolation levels to her. So let's try... My first intent was to create an analogy with something simple, for example, a book. Two people trying to read/write on the same book. They can read at the same … Continue reading Simple way to understand transaction isolation levels
In a previous post I talked about transaction log works, and what about using a memory-optimized table? SQL Server has the feature Memory-Optimized Objects to improve performance. In-memory nonclustered indexes are implemented using a data structure called a Bw-Tree. A Bw-Tree is a lock and latch-free variation of a B-Tree. In-memory architecture: To enable an … Continue reading Memory-optimized Logging
Checkpoints flush dirty data pages from the buffer cache of the current database to disk. This minimizes the active portion of the log that must be processed during a full recovery of a database. During a full recovery, the following types of actions are performed: The log records of modifications not flushed to disk before … Continue reading What the Checkpoint does?
To see how many VLFs you have solely look at the number of rows returned by DBCC LOGINFO. The size and number of VLFs you'll have depends largely on the size that the chunk is when it's added to you transaction log. There is no general rule how to determine the best values for the … Continue reading VLF (Virtual Log Files)
Doing crash and recovery tests on my local machine I got the SQL Server instance not going online. After trying the third time to bring my instance online thinking was something else problem I saw the SQL Server errolog file and I could see the problem. Not enough memory, but wasn't on my machine, was … Continue reading There is insufficient system memory in resource pool
One more undocumented function/commands. The fn_dump_dblog function is used to read transaction logs from a log backup file. This is an example fo the undocumented function to read transaction logs: SELECT [Current LSN], [Operation], [Transaction Name], [Transaction ID], SUSER_SNAME ([Transaction SID]) AS DBUser FROM fn_dump_dblog ( NULL, NULL, N'DISK', 1, N'C:\temp\Backup_Logfile.trn', DEFAULT, DEFAULT, … Continue reading SQL Server Undocumented 2