{"id":541,"date":"2010-12-23T19:33:00","date_gmt":"2010-12-23T19:33:00","guid":{"rendered":"\/blogs\/jonathan\/post\/An-XEvent-a-Day-(23-of-31)-e28093-How-it-Works-e28093-Multiple-Transaction-Log-Files.aspx"},"modified":"2017-04-13T12:18:28","modified_gmt":"2017-04-13T16:18:28","slug":"an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\/","title":{"rendered":"An XEvent a Day (23 of 31) \u2013 How it Works \u2013 Multiple Transaction Log Files"},"content":{"rendered":"<p>While working on yesterday\u2019s blog post <a href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-22-of-31-the-future-fn_dblog-no-more-tracking-transaction-log-activity-in-denali\/\">The Future \u2013 fn_dblog() No More? Tracking Transaction Log Activity in Denali<\/a> I did a quick Google search to find a specific blog post by Paul Randal to use it as a reference, and in the results returned another blog post titled, <a href=\"http:\/\/www.texastoo.com\/\">Investigating Multiple Transaction Log Files in SQL Server<\/a> caught my eye so I opened it in a new tab in IE and went about finishing the blog post.&#160; It probably wouldn\u2019t have gotten my attention if it hadn\u2019t been on the <a href=\"http:\/\/www.toadworld.com\/platforms\/sql-server\" target=\"_blank\">SqlServerPedia<\/a> site.&#160; When I was finished I went back and read through the post, and I found that some of the information presented in it was incorrect, so I attempted to post a comment, and not surprisingly the blog had moderation controls turned on, I have it turned on here if you aren\u2019t a SQLBlog member so I don\u2019t have a problem with that necessarily, and the comment didn\u2019t show up on the site.<\/p>\n<p>Interestingly enough, yesterday SQL Server Central had an editorial by Tim Mitchell titled <a href=\"http:\/\/www.sqlservercentral.com\/articles\/Editorial\/71897\/\" target=\"_blank\">Calling Out Bad Advice<\/a> that discussed the problem of bad information on the internet and how to go about calling people out for publishing bad advice.&#160; Lets face it, people are human, at least I am, and mistakes happen from time to time, either through our own misunderstandings of our personal experiences and what we perceived from the information we had, or by shear accident in some cases.&#160; This afternoon I got an email back from the blog post author and we traded a few emails about the post, and in the end the author made changes to the original post which have been syndicated to SQLServerPedia already, so to see the original you have do something like look at the <a href=\"http:\/\/webcache.googleusercontent.com\/search?q=cache:QJhzbbSajqMJ:sqlserverpedia.com\/blog\/sql-server-bloggers\/investigating-multiple-transaction-log-files-in-sql-server\/+http:\/\/sqlserverpedia.com\/blog\/sql-server-bloggers\/investigating-multiple-transaction-log-files-in-sql-server\/&amp;cd=1&amp;hl=en&amp;ct=clnk&amp;gl=us\" target=\"_blank\">Google Cached Copy<\/a>.&#160; The author also posted a follow up blog post today on the subject.<\/p>\n<p>So why this blog post?&#160; Well even with the corrections, some of the conclusions are still wrong.    <\/p>\n<p><a href=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/7da8c798\/image.png\"><img fetchpriority=\"high\" decoding=\"async\" style=\"border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/6e91e8be\/image_thumb.png\" width=\"644\" height=\"249\" \/><\/a> <\/p>\n<p>I am not trying to knock this guy for what he saw or perceived from the information he collected, but 2, 3 and 4 are still incorrect.&#160; What\u2019s great is we can prove this by using Extended Events in SQL Server 2008 and that is what the real purpose behind this blog post is.&#160; To set things up, we first need to create a database that roughly matches the available information shown in the pictures of the original blog post.&#160; The database will have a single database file, that I am sizing initially at 128MB and will have a fixed autogrowth value of 64MB.&#160; The database will have four log files that are initially sized at 1MB each, and the first log file will have a fixed autogrowth value of 32MB, with the last three transaction log files having fixed growth values of just 1MB.&#160; Don\u2019t comment on this configuration, I understand completely that there is no reason to create multiple log files on the same disk array (half the purpose behind this post is to show that there is no benefit to having multiple log files like this, which is also the intended purpose behind the original blog post as well), and I wouldn\u2019t do this in production, but it works perfectly for the tests that we are about to run.&#160; Once the database is created, we\u2019ll switch to that database, and dump out the transaction log VLF information using DBCC LOGINFO.<\/p>\n<blockquote>\n<pre class=\"code\"><span style=\"color: green\">-- Create our Test database with\r\n--        1 data file sized at 128MB with 64MB autogrowth\r\n--        1 log file sized at 1MB with 32MB autogrowth\r\n--        3 log files sized at 1MB with 1MB autogrowth\r\n<\/span><span style=\"color: blue\">CREATE DATABASE <\/span>[Test] <span style=\"color: blue\">ON  \r\nPRIMARY \r\n    <\/span><span style=\"color: gray\">(    \r\n        <\/span>NAME <span style=\"color: gray\">= <\/span><span style=\"color: red\">N'Test'<\/span><span style=\"color: gray\">, \r\n        <\/span><span style=\"color: blue\">FILENAME <\/span><span style=\"color: gray\">= <\/span><span style=\"color: red\">N'D:\\SQLData\\MSSQL10.MSSQLSERVER\\MSSQL\\DATA\\Test.mdf'<\/span><span style=\"color: gray\">, \r\n        <\/span>SIZE <span style=\"color: gray\">= <\/span>131072KB<span style=\"color: gray\">, \r\n        <\/span>FILEGROWTH <span style=\"color: gray\">= <\/span>65536KB\r\n    <span style=\"color: gray\">)\r\n<\/span><span style=\"color: magenta\">LOG <\/span><span style=\"color: blue\">ON \r\n    <\/span><span style=\"color: gray\">(    \r\n        <\/span>NAME <span style=\"color: gray\">= <\/span><span style=\"color: red\">N'Test_log'<\/span><span style=\"color: gray\">, \r\n        <\/span><span style=\"color: blue\">FILENAME <\/span><span style=\"color: gray\">= <\/span><span style=\"color: red\">N'L:\\SQLData\\MSSQL10.MSSQLSERVER\\MSSQL\\DATA\\Test_log.ldf'<\/span><span style=\"color: gray\">, \r\n        <\/span>SIZE <span style=\"color: gray\">= <\/span>1024KB<span style=\"color: gray\">, \r\n        <\/span>MAXSIZE <span style=\"color: gray\">= <\/span>131072KB<span style=\"color: gray\">, \r\n        <\/span>FILEGROWTH <span style=\"color: gray\">= <\/span>32768KB\r\n    <span style=\"color: gray\">), \r\n    (    \r\n        <\/span>NAME <span style=\"color: gray\">= <\/span><span style=\"color: red\">N'Test_log2'<\/span><span style=\"color: gray\">,     \r\n        <\/span><span style=\"color: blue\">FILENAME <\/span><span style=\"color: gray\">= <\/span><span style=\"color: red\">N'L:\\SQLData\\MSSQL10.MSSQLSERVER\\MSSQL\\DATA\\Test_log2.ldf'<\/span><span style=\"color: gray\">, \r\n        <\/span>SIZE <span style=\"color: gray\">= <\/span>1024KB<span style=\"color: gray\">, \r\n        <\/span>MAXSIZE <span style=\"color: gray\">= <\/span>131072KB<span style=\"color: gray\">, \r\n        <\/span>FILEGROWTH <span style=\"color: gray\">= <\/span>1024KB \r\n    <span style=\"color: gray\">), \r\n    ( \r\n        <\/span>NAME <span style=\"color: gray\">= <\/span><span style=\"color: red\">N'Test_log3'<\/span><span style=\"color: gray\">, \r\n        <\/span><span style=\"color: blue\">FILENAME <\/span><span style=\"color: gray\">= <\/span><span style=\"color: red\">N'L:\\SQLData\\MSSQL10.MSSQLSERVER\\MSSQL\\DATA\\Test_log3.ldf'<\/span><span style=\"color: gray\">, \r\n        <\/span>SIZE <span style=\"color: gray\">= <\/span>1024KB<span style=\"color: gray\">, \r\n        <\/span>MAXSIZE <span style=\"color: gray\">= <\/span>131072KB<span style=\"color: gray\">, \r\n        <\/span>FILEGROWTH <span style=\"color: gray\">= <\/span>1024KB \r\n    <span style=\"color: gray\">), \r\n    ( \r\n        <\/span>NAME <span style=\"color: gray\">= <\/span><span style=\"color: red\">N'Test_log4'<\/span><span style=\"color: gray\">, \r\n        <\/span><span style=\"color: blue\">FILENAME <\/span><span style=\"color: gray\">= <\/span><span style=\"color: red\">N'L:\\SQLData\\MSSQL10.MSSQLSERVER\\MSSQL\\DATA\\Test_log4.ldf'<\/span><span style=\"color: gray\">, \r\n        <\/span>SIZE <span style=\"color: gray\">= <\/span>1024KB<span style=\"color: gray\">, \r\n        <\/span>MAXSIZE <span style=\"color: gray\">= <\/span>131072KB<span style=\"color: gray\">, \r\n        <\/span>FILEGROWTH <span style=\"color: gray\">= <\/span>1024KB \r\n    <span style=\"color: gray\">)\r\n<\/span><span style=\"color: blue\">GO\r\n<\/span><span style=\"color: green\">-- Switch to our Test database\r\n<\/span><span style=\"color: blue\">USE <\/span>[Test]\r\n<span style=\"color: blue\">GO\r\n<\/span><span style=\"color: green\">-- Dump the VLF Usage information\r\n<\/span><span style=\"color: blue\">DBCC <\/span>LOGINFO\r\n<span style=\"color: blue\">GO<\/span><\/pre>\n<p>  <a href=\"http:\/\/www.11011.net\/software\/vspaste\"><\/a><\/p><\/blockquote>\n<p><a href=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/0d685c9d\/image.png\" target=\"_blank\"><img decoding=\"async\" style=\"border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/4c59dd38\/image_thumb.png\" width=\"417\" height=\"361\" \/><\/a><\/p>\n<p>Each of the log files VLF\u2019s have been highlighted in a different color above to point out the separation of the four different files.&#160; Note that the active VLF is in the first log file, FileId=2, as shown by the Status=2.&#160; With our test database created, we can now set out to create the Extended Events Event Session that:<\/p>\n<ol>\n<ol>\n<li>The transaction logs are written to sequentially starting with the first VLF in FileId=2 and then when the last VLF in FileId=2 is full, the log begins writing log records to the first VLF of FileId=3 and when the last VLF in FileId=3 is full, the log begins writing log records to the first VLF of FileId=4 and when the last VLF in FileId=4 is full, the log begins writing log records to the first VLF of FileId=5 and when the last VLF in FileId=5 is full, the log circles back to the first VLF of FileId=2 which will still be active because we are going to work within a single explicit transaction for the duration of the test.&#160; Since the file is full it has to be grown, and because it has a growth factor of 32MB it grows by 32MB and begins writing log records to the first VLF of the newly allocated space. <\/li>\n<li>The writes to the log files do not happen at the same time, they occur sequentially as the engine writes log records into each file, filling the VLF\u2019s and has to move to the next file, or circle back to the beginning of the log when it reaches the end of the last log file. <\/li>\n<li>Whatever results were seen in the original thread by opening the log file with Apex tools were incorrect and misleading to the original poster, since log files were actually written to all of the files during the operation.&#160; I have a couple of theories as to what could have happened that made the Apex tool show no log records that I will discuss later in this thread. <\/li>\n<\/ol>\n<\/ol>\n<p>What Events would we want to capture to look at what is happening in our transaction log files when running the same workload from the original post?&#160; Since we are going to be executing a number of statements, the sqlserver.sql_statement_starting and sqlserver.sql_statement_completed Events seem like a good starting point, and since we want to know what statement was executing, we\u2019ll add the sql_text Action to these Events.&#160; Since we are dealing with the transaction log files, the sqlserver.databases_log_file_size_changed, sqlserver.databases_log_file_used_size_changed, sqlserver.databases_log_flush_wait, sqlserver.databases_log_flush, sqlserver.databases_log_growth, and sqlserver.databases_log_truncation Events should probably be included to so we can track what\u2019s going on with our log specifically, and to ensure that these Events only fire for our test database, we\u2019ll dynamically build in a Predicate on the sqlserver.database_id Predicate source using the output of DB_ID() inside the testing database.&#160; <\/p>\n<p>Since the log is a file, we also will want to collect the file operation related events such as sqlserver.flush_file_buffers, sqlserver.file_read, sqlserver.file_written, sqlserver.file_read_completed, and sqlserver.file_write_completed, and we\u2019ll dynamically set a database_id Predicate on these Events as well.&#160; If you recall back to Friday of last week, I talked about a number of trace flags that provide further information about Backup, Restore and file operations in my blog post <a href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/\">A Look at Backup Internals and How to Track Backup and Restore Throughput (Part 1)<\/a>.&#160; One of those was Trace Flag 3004, which writes file zeroing information to the trace print output whenever a zeroing operation occurs.&#160; I previously used this trace flag in my blog post <a href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/does-the-tempdb-log-file-get-zero-initialized-at-startup\/\">Does the tempdb Log file get Zero Initialized at Startup?<\/a>&#160; Since the log files grew in the original tests, we can turn this trace flag on to track the file growths, and use the sqlserver.trace_print Event to capture the file operation messages, and to keep this Event focused to our tests only, we\u2019ll dynamically set a Predicate for the current session_id using the sqlserver.session_id Predicate Source and the output of @@SPID.&#160; Finally since this is all happening inside of an explicit transaction, we\u2019ll also capture the sqlserver.database_transaction_begin and sqlserver.database_transaction_end events for the current database_id.<\/p>\n<p>We have quite a large list of Events associated with this Event Session, and to ensure that we can perform analysis over all of the Event data from our tests, we\u2019ll use the package0.asynchronous_file_target to hold our Event information.&#160; We\u2019ll also increase our buffer memory from the default 4MB to 8MB and set the Event Session up to ALLOW_SINGLE_EVENT_LOSS, which does exactly what it sounds like it does, and to correlate cause and effect we\u2019ll also turn TRACK_CAUSALITY to ON for the session.<\/p>\n<blockquote>\n<pre class=\"code\"><span style=\"color: green\">-- Create our Event Session dynamically\r\n<\/span><span style=\"color: blue\">DECLARE <\/span>@sqlcmd <span style=\"color: blue\">nvarchar<\/span><span style=\"color: gray\">(<\/span>2000<span style=\"color: gray\">) = <\/span><span style=\"color: red\">'\r\nCREATE EVENT SESSION TransactionLogUsage\r\nON SERVER\r\n--ADD EVENT sqlserver.sql_statement_starting\r\n--( ACTION(sqlserver.sql_text)\r\n--  WHERE (sqlserver.database_id = '<\/span><span style=\"color: gray\">+ <\/span><span style=\"color: magenta\">cast<\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">DB_ID<\/span><span style=\"color: gray\">() <\/span><span style=\"color: blue\">as varchar<\/span><span style=\"color: gray\">(<\/span>3<span style=\"color: gray\">))+<\/span><span style=\"color: red\">')),\r\n--ADD EVENT sqlserver.sql_statement_completed\r\n--( ACTION(sqlserver.sql_text)\r\n--  WHERE (sqlserver.database_id = '<\/span><span style=\"color: gray\">+ <\/span><span style=\"color: magenta\">cast<\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">DB_ID<\/span><span style=\"color: gray\">() <\/span><span style=\"color: blue\">as varchar<\/span><span style=\"color: gray\">(<\/span>3<span style=\"color: gray\">))+<\/span><span style=\"color: red\">')),\r\nADD EVENT sqlserver.databases_log_file_size_changed\r\n( WHERE (sqlserver.database_id = '<\/span><span style=\"color: gray\">+ <\/span><span style=\"color: magenta\">cast<\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">DB_ID<\/span><span style=\"color: gray\">() <\/span><span style=\"color: blue\">as varchar<\/span><span style=\"color: gray\">(<\/span>3<span style=\"color: gray\">))+<\/span><span style=\"color: red\">')),\r\nADD EVENT sqlserver.databases_log_file_used_size_changed\r\n( WHERE (sqlserver.database_id = '<\/span><span style=\"color: gray\">+ <\/span><span style=\"color: magenta\">cast<\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">DB_ID<\/span><span style=\"color: gray\">() <\/span><span style=\"color: blue\">as varchar<\/span><span style=\"color: gray\">(<\/span>3<span style=\"color: gray\">))+<\/span><span style=\"color: red\">')),\r\nADD EVENT sqlserver.databases_log_flush_wait\r\n( WHERE (sqlserver.database_id = '<\/span><span style=\"color: gray\">+ <\/span><span style=\"color: magenta\">cast<\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">DB_ID<\/span><span style=\"color: gray\">() <\/span><span style=\"color: blue\">as varchar<\/span><span style=\"color: gray\">(<\/span>3<span style=\"color: gray\">))+<\/span><span style=\"color: red\">')),\r\nADD EVENT sqlserver.databases_log_flush\r\n( WHERE (sqlserver.database_id = '<\/span><span style=\"color: gray\">+ <\/span><span style=\"color: magenta\">cast<\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">DB_ID<\/span><span style=\"color: gray\">() <\/span><span style=\"color: blue\">as varchar<\/span><span style=\"color: gray\">(<\/span>3<span style=\"color: gray\">))+<\/span><span style=\"color: red\">')),\r\nADD EVENT sqlserver.databases_log_growth\r\n( WHERE (sqlserver.database_id = '<\/span><span style=\"color: gray\">+ <\/span><span style=\"color: magenta\">cast<\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">DB_ID<\/span><span style=\"color: gray\">() <\/span><span style=\"color: blue\">as varchar<\/span><span style=\"color: gray\">(<\/span>3<span style=\"color: gray\">))+<\/span><span style=\"color: red\">')),\r\nADD EVENT sqlserver.databases_log_truncation\r\n( WHERE (sqlserver.database_id = '<\/span><span style=\"color: gray\">+ <\/span><span style=\"color: magenta\">cast<\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">DB_ID<\/span><span style=\"color: gray\">() <\/span><span style=\"color: blue\">as varchar<\/span><span style=\"color: gray\">(<\/span>3<span style=\"color: gray\">))+<\/span><span style=\"color: red\">')),\r\nADD EVENT sqlserver.flush_file_buffers\r\n( WHERE (sqlserver.database_id = '<\/span><span style=\"color: gray\">+ <\/span><span style=\"color: magenta\">cast<\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">DB_ID<\/span><span style=\"color: gray\">() <\/span><span style=\"color: blue\">as varchar<\/span><span style=\"color: gray\">(<\/span>3<span style=\"color: gray\">))+<\/span><span style=\"color: red\">')),\r\nADD EVENT sqlserver.file_read\r\n( WHERE (sqlserver.database_id = '<\/span><span style=\"color: gray\">+ <\/span><span style=\"color: magenta\">cast<\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">DB_ID<\/span><span style=\"color: gray\">() <\/span><span style=\"color: blue\">as varchar<\/span><span style=\"color: gray\">(<\/span>3<span style=\"color: gray\">))+<\/span><span style=\"color: red\">')),\r\nADD EVENT sqlserver.file_written\r\n( WHERE (sqlserver.database_id = '<\/span><span style=\"color: gray\">+ <\/span><span style=\"color: magenta\">cast<\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">DB_ID<\/span><span style=\"color: gray\">() <\/span><span style=\"color: blue\">as varchar<\/span><span style=\"color: gray\">(<\/span>3<span style=\"color: gray\">))+<\/span><span style=\"color: red\">')),\r\nADD EVENT sqlserver.file_read_completed\r\n( WHERE (sqlserver.database_id = '<\/span><span style=\"color: gray\">+ <\/span><span style=\"color: magenta\">cast<\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">DB_ID<\/span><span style=\"color: gray\">() <\/span><span style=\"color: blue\">as varchar<\/span><span style=\"color: gray\">(<\/span>3<span style=\"color: gray\">))+<\/span><span style=\"color: red\">')),\r\nADD EVENT sqlserver.file_write_completed\r\n( WHERE (sqlserver.database_id = '<\/span><span style=\"color: gray\">+ <\/span><span style=\"color: magenta\">cast<\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">DB_ID<\/span><span style=\"color: gray\">() <\/span><span style=\"color: blue\">as varchar<\/span><span style=\"color: gray\">(<\/span>3<span style=\"color: gray\">))+<\/span><span style=\"color: red\">')),\r\nADD EVENT sqlserver.trace_print\r\n(   WHERE (sqlserver.session_id = '<\/span><span style=\"color: gray\">+ <\/span><span style=\"color: magenta\">cast<\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">@@SPID <\/span><span style=\"color: blue\">as varchar<\/span><span style=\"color: gray\">(<\/span>4<span style=\"color: gray\">))+<\/span><span style=\"color: red\">')),\r\nADD EVENT sqlserver.database_transaction_begin\r\n( WHERE (sqlserver.database_id = '<\/span><span style=\"color: gray\">+ <\/span><span style=\"color: magenta\">cast<\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">DB_ID<\/span><span style=\"color: gray\">() <\/span><span style=\"color: blue\">as varchar<\/span><span style=\"color: gray\">(<\/span>3<span style=\"color: gray\">))+<\/span><span style=\"color: red\">')),\r\nADD EVENT sqlserver.database_transaction_end\r\n( WHERE (sqlserver.database_id = '<\/span><span style=\"color: gray\">+ <\/span><span style=\"color: magenta\">cast<\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">DB_ID<\/span><span style=\"color: gray\">() <\/span><span style=\"color: blue\">as varchar<\/span><span style=\"color: gray\">(<\/span>3<span style=\"color: gray\">))+<\/span><span style=\"color: red\">'))\r\nADD TARGET package0.asynchronous_file_target(\r\n     SET filename=''C:\\SQLBlog\\TransactionLogUsage.xel'',\r\n         metadatafile=''C:\\SQLBlog\\TransactionLogUsage.xem'')\r\nWITH (MAX_MEMORY = 8MB, EVENT_RETENTION_MODE = ALLOW_SINGLE_EVENT_LOSS, TRACK_CAUSALITY = ON )'\r\n<\/span><span style=\"color: blue\">EXEC <\/span><span style=\"color: gray\">(<\/span>@sqlcmd<span style=\"color: gray\">)\r\n<\/span><span style=\"color: blue\">GO<\/span><\/pre>\n<p>  <a href=\"http:\/\/www.11011.net\/software\/vspaste\"><\/a><\/p><\/blockquote>\n<p>If you notice above, I have commented out the sqlserver.sql_statement_starting and sqlserver.sql_statement_completed Events in the Event Session.&#160; It turns out that these two events are not needed in the Event Session to prove the points being made in this blog post.&#160; Including these two events makes the time to process the 240K+ Events run in the 10-15 minute range on my 16 core test server, so its not likely something that you are going to do on a laptop VM, but they were included in my initial Event Session for this, and I wanted to show the thought process I followed to get from A to B and ultimately C.<\/p>\n<p>With our Event Session created, we can finish setting up our environment to run the actual tests.&#160; To do this we\u2019ll create a table named LogTable with two columns that are, as best as I can tell from the limited information provided about the test table, the same as the table used in the original post.&#160; We\u2019ll then CHECKPOINT the database to cause log truncation to occur (you did create the database in SIMPLE recovery right?), turn on Trace Flag 3004 for our session, and then start the Event Session so that it collects the data from our Events during our test.<\/p>\n<blockquote>\n<pre class=\"code\"><span style=\"color: green\">-- Create our Test Table\r\n<\/span><span style=\"color: blue\">CREATE TABLE <\/span>LogTable <span style=\"color: gray\">(<\/span>RowID <span style=\"color: blue\">decimal<\/span><span style=\"color: gray\">(<\/span>10<span style=\"color: gray\">,<\/span>4<span style=\"color: gray\">), <\/span>Data <span style=\"color: blue\">char<\/span><span style=\"color: gray\">(<\/span>1024<span style=\"color: gray\">))\r\n<\/span><span style=\"color: blue\">GO\r\n<\/span><span style=\"color: green\">-- Checkpoint the database to truncate and clear the log.\r\n<\/span><span style=\"color: blue\">CHECKPOINT\r\nGO\r\n<\/span><span style=\"color: green\">-- Turn on Trace Flag 3004 so we can see file zeroing ops.\r\n<\/span><span style=\"color: blue\">DBCC <\/span>TRACEON<span style=\"color: gray\">(<\/span>3004<span style=\"color: gray\">)\r\n<\/span><span style=\"color: blue\">GO\r\n<\/span><span style=\"color: green\">-- Start the Event Session\r\n<\/span><span style=\"color: blue\">ALTER EVENT SESSION <\/span>TransactionLogUsage\r\n<span style=\"color: blue\">ON SERVER\r\nSTATE<\/span><span style=\"color: gray\">=<\/span>START\r\n<span style=\"color: blue\">GO<\/span><\/pre>\n<p>  <a href=\"http:\/\/www.11011.net\/software\/vspaste\"><\/a><\/p><\/blockquote>\n<p>With the Event Session started and all our setup work completed we can now run the test script that was used in the original post to generate our test workload.&#160; When the tests complete, we\u2019ll dump out our VLF information again with DBCC LOGINFO, then ROLLBACK the transaction, switch to master and DROP our test database and the Extended Events Session from the server since they are no longer needed.<\/p>\n<blockquote>\n<pre class=\"code\"><span style=\"color: green\">-- Run our tests\r\n<\/span><span style=\"color: blue\">SET NOCOUNT ON\r\n\r\nDECLARE <\/span>@cnt <span style=\"color: blue\">decimal<\/span><span style=\"color: gray\">(<\/span>10<span style=\"color: gray\">,<\/span>4<span style=\"color: gray\">)=<\/span>0\r\n<span style=\"color: blue\">DECLARE <\/span>@rows <span style=\"color: blue\">int<\/span><span style=\"color: gray\">=<\/span>0\r\n<span style=\"color: blue\">BEGIN TRAN\r\nWHILE <\/span>1<span style=\"color: gray\">=<\/span>1\r\n<span style=\"color: blue\">BEGIN\r\n    INSERT INTO <\/span>LogTable <span style=\"color: blue\">VALUES <\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">ROUND<\/span><span style=\"color: gray\">((<\/span><span style=\"color: magenta\">RAND<\/span><span style=\"color: gray\">()* <\/span>1000000<span style=\"color: gray\">),<\/span>0<span style=\"color: gray\">), <\/span><span style=\"color: magenta\">SPACE<\/span><span style=\"color: gray\">(<\/span>1024<span style=\"color: gray\">))\r\n    \r\n    <\/span><span style=\"color: blue\">SELECT <\/span>@rows<span style=\"color: gray\">+=<\/span>1\r\n        \r\n    <span style=\"color: blue\">SELECT <\/span>@cnt <span style=\"color: gray\">= (<\/span>size <span style=\"color: gray\">* <\/span>1.0 <span style=\"color: gray\">* <\/span>8.0<span style=\"color: gray\">)\/<\/span>1024.0 \r\n    <span style=\"color: blue\">FROM  <\/span>Test<span style=\"color: gray\">.<\/span><span style=\"color: green\">sys<\/span><span style=\"color: gray\">.<\/span><span style=\"color: green\">database_files\r\n    <\/span><span style=\"color: blue\">WHERE <\/span>data_space_id <span style=\"color: gray\">= <\/span>0\r\n    <span style=\"color: gray\">AND <\/span>[FILE_ID]<span style=\"color: gray\">=<\/span>5\r\n    \r\n    <span style=\"color: blue\">IF <\/span>@cnt<span style=\"color: gray\">&gt;<\/span>1.0\r\n            <span style=\"color: blue\">BREAK\r\nEND\r\n\r\nSELECT <\/span>@rows<span style=\"color: gray\">;\r\n<\/span><span style=\"color: blue\">GO\r\n<\/span><span style=\"color: green\">-- Pull Log VLF usage again\r\n<\/span><span style=\"color: blue\">DBCC <\/span>LOGINFO\r\n<span style=\"color: blue\">GO\r\n<\/span><span style=\"color: green\">-- Rollback our transaction\r\n<\/span><span style=\"color: blue\">ROLLBACK\r\nGO\r\nUSE master\r\nGO\r\n<\/span><span style=\"color: green\">-- Kill any connection to Test database\r\n<\/span><span style=\"color: blue\">ALTER DATABASE <\/span>[Test] <span style=\"color: blue\">SET SINGLE_USER WITH ROLLBACK IMMEDIATE<\/span><span style=\"color: gray\">;\r\n<\/span><span style=\"color: blue\">GO\r\n<\/span><span style=\"color: green\">-- Drop the Test database\r\n<\/span><span style=\"color: blue\">DROP DATABASE <\/span>[Test]\r\n<span style=\"color: blue\">GO\r\n<\/span><span style=\"color: green\">-- Drop the Event Session\r\n<\/span><span style=\"color: blue\">DROP EVENT SESSION <\/span>TransactionLogUsage\r\n<span style=\"color: blue\">ON SERVER\r\nGO<\/span><\/pre>\n<\/blockquote>\n<p><a href=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/6072f9c1\/image3.png\" target=\"_blank\"><img decoding=\"async\" style=\"border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/2a8e04a7\/image3_thumb.png\" width=\"355\" height=\"484\" \/><\/a><\/p>\n<\/p>\n<p>There is a reason that I dump out the VLF information before performing the ROLLBACK of the transaction.&#160; As long as the transaction remains active, the VLF\u2019s containing the active transaction can not be truncated and cleared.&#160; In order to see the allocated VLF\u2019s, we need the transaction active still.&#160; Once again, I have highlighted each of the individual log files separately, and from the DBCC LOGINFO output we can look at the FileId and Status columns and see that our transaction log wrote information into all 4 of the files, filling them, and the wrapped back to the first file which had to be grown, and each of the subsequent log files were also grown by the database engine.&#160; However, if you look at the CreateLSN information for the growth portion of each log file, you will notice that each file has its own Create LSN value for the second set of VLF\u2019s, meaning that they were grown separately and at different times.&#160; Still not convinced by DBCC LOGINFO?&#160; Well we have the data to validate this and prove it unequivocally, but before we can look at the data, we need to retrieve it from the asynchronous_file_target files and shred the XML using XQuery.<\/p>\n<blockquote>\n<pre class=\"code\"><span style=\"color: green\">-- Create our Analysis Database\r\n<\/span><span style=\"color: blue\">CREATE DATABASE <\/span>TLogUsageTestResults\r\n<span style=\"color: blue\">GO\r\n<\/span><span style=\"color: green\">-- Switch to our Analysis Database\r\n<\/span><span style=\"color: blue\">USE <\/span>[TLogUsageTestResults]\r\n<span style=\"color: blue\">GO\r\n<\/span><span style=\"color: green\">-- Create intermediate temp table for raw event data\r\n<\/span><span style=\"color: blue\">CREATE TABLE <\/span>RawEventData\r\n<span style=\"color: gray\">(<\/span>Rowid <span style=\"color: blue\">int identity primary key<\/span><span style=\"color: gray\">, <\/span>event_data <span style=\"color: blue\">xml<\/span><span style=\"color: gray\">)\r\n\r\n<\/span><span style=\"color: green\">-- Create final results table for parsed event data\r\n<\/span><span style=\"color: blue\">CREATE TABLE <\/span>TestResults\r\n<span style=\"color: gray\">(<\/span>[Rowid] <span style=\"color: blue\">int primary key<\/span><span style=\"color: gray\">, <\/span>[event_name] <span style=\"color: blue\">varchar<\/span><span style=\"color: gray\">(<\/span>50<span style=\"color: gray\">), <\/span>[package_name] <span style=\"color: blue\">varchar<\/span><span style=\"color: gray\">(<\/span>50<span style=\"color: gray\">),\r\n <\/span>[timestamp] <span style=\"color: blue\">datetime2<\/span><span style=\"color: gray\">, <\/span>[count] <span style=\"color: blue\">bigint<\/span><span style=\"color: gray\">, <\/span>[increment] <span style=\"color: blue\">bigint<\/span><span style=\"color: gray\">, <\/span>[database_id] <span style=\"color: blue\">int<\/span><span style=\"color: gray\">, \r\n <\/span>[mode] <span style=\"color: blue\">nvarchar<\/span><span style=\"color: gray\">(<\/span>4000<span style=\"color: gray\">), <\/span>[file_handle] <span style=\"color: blue\">nvarchar<\/span><span style=\"color: gray\">(<\/span>4000<span style=\"color: gray\">), <\/span>[offset] <span style=\"color: blue\">bigint<\/span><span style=\"color: gray\">, \r\n <\/span>[file_id] <span style=\"color: blue\">int<\/span><span style=\"color: gray\">, <\/span>[file_group_id] <span style=\"color: blue\">int<\/span><span style=\"color: gray\">, <\/span>[path] <span style=\"color: blue\">nvarchar<\/span><span style=\"color: gray\">(<\/span>4000<span style=\"color: gray\">), <\/span>[duration] <span style=\"color: blue\">bigint<\/span><span style=\"color: gray\">, \r\n <\/span>[io_data] <span style=\"color: blue\">nvarchar<\/span><span style=\"color: gray\">(<\/span>4000<span style=\"color: gray\">), <\/span>[succeeded] <span style=\"color: blue\">nvarchar<\/span><span style=\"color: gray\">(<\/span>4000<span style=\"color: gray\">), <\/span>[sql_text] <span style=\"color: blue\">nvarchar<\/span><span style=\"color: gray\">(<\/span>4000<span style=\"color: gray\">), \r\n <\/span>[trace_message] <span style=\"color: blue\">nvarchar<\/span><span style=\"color: gray\">(<\/span>4000<span style=\"color: gray\">), <\/span>[source_database_id] <span style=\"color: blue\">int<\/span><span style=\"color: gray\">, <\/span>[object_id] <span style=\"color: blue\">int<\/span><span style=\"color: gray\">, \r\n <\/span>[object_type] <span style=\"color: blue\">int<\/span><span style=\"color: gray\">, <\/span>[cpu] <span style=\"color: blue\">int<\/span><span style=\"color: gray\">, <\/span>[reads] <span style=\"color: blue\">bigint<\/span><span style=\"color: gray\">, <\/span>[writes] <span style=\"color: blue\">bigint<\/span><span style=\"color: gray\">, \r\n <\/span>[state] <span style=\"color: blue\">nvarchar<\/span><span style=\"color: gray\">(<\/span>4000<span style=\"color: gray\">), <\/span>[offset_end] <span style=\"color: blue\">int<\/span><span style=\"color: gray\">, <\/span>[nest_level] <span style=\"color: blue\">int<\/span><span style=\"color: gray\">, \r\n <\/span>[activity_id] <span style=\"color: blue\">uniqueidentifier<\/span><span style=\"color: gray\">, <\/span>[event_sequence] <span style=\"color: blue\">int <\/span><span style=\"color: gray\">)\r\n\r\n<\/span><span style=\"color: green\">-- Read the file data into intermediate temp table\r\n<\/span><span style=\"color: blue\">INSERT INTO <\/span>RawEventData <span style=\"color: gray\">(<\/span>event_data<span style=\"color: gray\">)\r\n<\/span><span style=\"color: blue\">SELECT\r\n    <\/span><span style=\"color: magenta\">CAST<\/span><span style=\"color: gray\">(<\/span>event_data <span style=\"color: blue\">AS XML<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>event_data\r\n<span style=\"color: blue\">FROM <\/span><span style=\"color: green\">sys<\/span><span style=\"color: gray\">.<\/span>fn_xe_file_target_read_file<span style=\"color: gray\">(<\/span><span style=\"color: red\">'C:\\SQLBlog\\TransactionLogUsage*.xel'<\/span><span style=\"color: gray\">, \r\n                                     <\/span><span style=\"color: red\">'C:\\SQLBlog\\TransactionLogUsage*.xem'<\/span><span style=\"color: gray\">, \r\n                                     null, null)\r\n\r\n<\/span><span style=\"color: green\">-- Query the Event data from the Target.\r\n<\/span><span style=\"color: blue\">INSERT INTO <\/span>TestResults\r\n<span style=\"color: gray\">(<\/span>[Rowid]<span style=\"color: gray\">, <\/span>[event_name]<span style=\"color: gray\">, <\/span>[timestamp]<span style=\"color: gray\">, <\/span>[database_id]<span style=\"color: gray\">, <\/span>[count]<span style=\"color: gray\">, <\/span>[increment]<span style=\"color: gray\">, \r\n <\/span>[mode]<span style=\"color: gray\">, <\/span>[file_handle]<span style=\"color: gray\">, <\/span>[offset]<span style=\"color: gray\">, <\/span>[file_id]<span style=\"color: gray\">, <\/span>[file_group_id]<span style=\"color: gray\">, <\/span>[path]<span style=\"color: gray\">, \r\n <\/span>[duration]<span style=\"color: gray\">, <\/span>[io_data]<span style=\"color: gray\">, <\/span>[succeeded]<span style=\"color: gray\">, <\/span>[sql_text]<span style=\"color: gray\">, <\/span>[trace_message]<span style=\"color: gray\">, <\/span>[source_database_id]<span style=\"color: gray\">, \r\n <\/span>[object_id]<span style=\"color: gray\">, <\/span>[object_type]<span style=\"color: gray\">, <\/span>[cpu]<span style=\"color: gray\">, <\/span>[reads]<span style=\"color: gray\">, <\/span>[writes]<span style=\"color: gray\">, <\/span>[state]<span style=\"color: gray\">, <\/span>[offset_end]<span style=\"color: gray\">, \r\n <\/span>[nest_level]<span style=\"color: gray\">, <\/span>[activity_id]<span style=\"color: gray\">, <\/span>[event_sequence]<span style=\"color: gray\">)\r\n\r\n<\/span><span style=\"color: green\">-- Fetch the Event Data from the Event Session Target\r\n<\/span><span style=\"color: blue\">SELECT \r\n    <\/span>RowID<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/@name)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'varchar(50)'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>event_name<span style=\"color: gray\">,\r\n    <\/span><span style=\"color: magenta\">DATEADD<\/span><span style=\"color: gray\">(<\/span>hh<span style=\"color: gray\">, \r\n            <\/span><span style=\"color: magenta\">DATEDIFF<\/span><span style=\"color: gray\">(<\/span>hh<span style=\"color: gray\">, <\/span><span style=\"color: magenta\">GETUTCDATE<\/span><span style=\"color: gray\">(), <\/span><span style=\"color: magenta\">CURRENT_TIMESTAMP<\/span><span style=\"color: gray\">), \r\n            <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/@timestamp)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'datetime2'<\/span><span style=\"color: gray\">)) <\/span><span style=\"color: blue\">AS <\/span>[timestamp]<span style=\"color: gray\">,\r\n    <\/span><span style=\"color: magenta\">COALESCE<\/span><span style=\"color: gray\">(<\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;database_id&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'int'<\/span><span style=\"color: gray\">), \r\n             <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/action[@name=&quot;database_id&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'int'<\/span><span style=\"color: gray\">)) <\/span><span style=\"color: blue\">AS <\/span>database_id<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;count&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'bigint'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[count]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;increment&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'bigint'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[increment]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;mode&quot;]\/text)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'nvarchar(4000)'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[mode]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;file_handle&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'nvarchar(4000)'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[file_handle]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;offset&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'bigint'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[offset]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;file_id&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'int'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[file_id]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;file_group_id&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'int'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[file_group_id]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;path&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'nvarchar(4000)'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[path]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;duration&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'bigint'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[duration]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;io_data&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'nvarchar(4000)'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[io_data]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;succeeded&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'nvarchar(4000)'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[succeeded]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/action[@name=&quot;sql_text&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'nvarchar(4000)'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[sql_text]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;message&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'nvarchar(4000)'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[trace_message]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;source_database_id&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'int'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[source_database_id]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;object_id&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'int'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[object_id]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;object_type&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'int'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[object_type]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;cpu&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'int'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[cpu]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;reads&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'bigint'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[reads]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;writes&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'bigint'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[writes]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;state&quot;]\/text)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'nvarchar(4000)'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[state]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;offset_end&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'int'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[offset_end]<span style=\"color: gray\">,\r\n    <\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/data[@name=&quot;nest_level&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'int'<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span>[nest_level]<span style=\"color: gray\">,\r\n    <\/span><span style=\"color: magenta\">CAST<\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">SUBSTRING<\/span><span style=\"color: gray\">(<\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/action[@name=&quot;attach_activity_id&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'varchar(50)'<\/span><span style=\"color: gray\">), <\/span>1<span style=\"color: gray\">, <\/span>36<span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS uniqueidentifier<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">as <\/span>activity_id<span style=\"color: gray\">,\r\n    <\/span><span style=\"color: magenta\">CAST<\/span><span style=\"color: gray\">(<\/span><span style=\"color: magenta\">SUBSTRING<\/span><span style=\"color: gray\">(<\/span>event_data<span style=\"color: gray\">.<\/span>value<span style=\"color: gray\">(<\/span><span style=\"color: red\">'(event\/action[@name=&quot;attach_activity_id&quot;]\/value)[1]'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'varchar(50)'<\/span><span style=\"color: gray\">), <\/span>38<span style=\"color: gray\">, <\/span>10<span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS int<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">as <\/span>event_sequence\r\n<span style=\"color: blue\">FROM <\/span>RawEventData\r\n<span style=\"color: blue\">ORDER BY <\/span>Rowid\r\n<span style=\"color: blue\">GO\r\n\r\n<\/span><span style=\"color: green\">-- Return our results\r\n<\/span><span style=\"color: blue\">SELECT <\/span><span style=\"color: gray\">* \r\n<\/span><span style=\"color: blue\">FROM <\/span>TestResults\r\n<span style=\"color: blue\">WHERE <\/span>event_name <span style=\"color: gray\">NOT IN (<\/span><span style=\"color: red\">'sql_statement_starting' <\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'sql_statement_completed'<\/span><span style=\"color: gray\">)\r\n<\/span><span style=\"color: blue\">ORDER BY <\/span>RowID<\/pre>\n<p>  <a href=\"http:\/\/www.11011.net\/software\/vspaste\"><\/a><\/p><\/blockquote>\n<p>If you scroll through the results you can see the writes occurring sequentially through each of the log files, and while FileId=4 is being written to, the Database Engine begins the growth of FileId=2 by 32MB.&#160; If we change our query to only focus on the file_write_completed, databases_log_growth, and trace_print Events, we can see this a little easier.<\/p>\n<blockquote>\n<pre class=\"code\"><span style=\"color: green\">-- Return our results\r\n<\/span><span style=\"color: blue\">SELECT \r\n    <\/span>Rowid<span style=\"color: gray\">, \r\n    <\/span>event_name<span style=\"color: gray\">, \r\n    <\/span>[timestamp]<span style=\"color: gray\">, \r\n    <\/span>[count]<span style=\"color: gray\">, \r\n    <\/span>database_id<span style=\"color: gray\">, \r\n    <\/span>mode<span style=\"color: gray\">, \r\n    <\/span>offset<span style=\"color: gray\">, \r\n    <\/span><span style=\"color: magenta\">file_id<\/span><span style=\"color: gray\">, \r\n    <\/span>duration<span style=\"color: gray\">, \r\n    <\/span>trace_message \r\n<span style=\"color: blue\">FROM <\/span>TestResults\r\n<span style=\"color: blue\">WHERE <\/span>event_name  <span style=\"color: gray\">IN (<\/span><span style=\"color: red\">'file_write_completed' <\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'databases_log_growth'<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">'trace_print'<\/span><span style=\"color: gray\">)\r\n<\/span><span style=\"color: blue\">ORDER BY <\/span>RowID<\/pre>\n<p>  <a href=\"http:\/\/www.11011.net\/software\/vspaste\"><\/a><\/p><\/blockquote>\n<p align=\"center\">\n<table>\n<tbody>\n<tr>\n<td><a href=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/7b0f700d\/image.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/21052064\/image_thumb.png\" width=\"324\" height=\"120\" \/><\/a> <\/td>\n<td>&#160;&#160; <\/td>\n<td><a href=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/52245b04\/image.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/235ea262\/image_thumb.png\" width=\"324\" height=\"120\" \/><\/a> <\/td>\n<\/tr>\n<tr>\n<td><strong>Log Rollover from Log1 to Log2<\/strong><\/td>\n<td>&#160;<\/td>\n<td><strong>Log Rollover from Log2 to Log3<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p align=\"left\">&#160;<\/p>\n<p align=\"center\">\n<table>\n<tbody>\n<tr>\n<td>\n<p><a href=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/7741a570\/image.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/487becce\/image_thumb.png\" width=\"324\" height=\"93\" \/><\/a> <\/p>\n<\/td>\n<td>&#160;&#160; <\/td>\n<td><a href=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/1171e8c8\/image.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/78b29bb7\/image_thumb.png\" width=\"324\" height=\"120\" \/><\/a> <\/td>\n<\/tr>\n<tr>\n<td><strong>Autogrow of Log1<\/strong><\/td>\n<td>&#160;<\/td>\n<td><strong>Log Rollover from Log3 to Log4<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p align=\"left\">&#160;<\/p>\n<p align=\"center\">\n<table>\n<tbody>\n<tr>\n<td><a href=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/05ac7bc9\/image.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/7cdc737c\/image_thumb.png\" width=\"324\" height=\"119\" \/><\/a><\/td>\n<td>&#160;&#160; <\/td>\n<td><a href=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/5be900d5\/image.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/68e2e0e6\/image_thumb.png\" width=\"324\" height=\"95\" \/><\/a> <\/td>\n<\/tr>\n<tr>\n<td><strong>Log Rollover from Log4 back to Log1<\/strong><\/td>\n<td>&#160;<\/td>\n<td><strong>Autogrow of Log2<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#160;<\/p>\n<div align=\"center\">\n<table width=\"2\">\n<tbody>\n<tr>\n<td><a href=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/52acc594\/image.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/46aad560\/image_thumb.png\" width=\"324\" height=\"93\" \/><\/a> <\/td>\n<td>&#160;&#160; <\/td>\n<td><a href=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/77ca1000\/image.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/04c3f012\/image_thumb.png\" width=\"324\" height=\"93\" \/><\/a> <\/td>\n<\/tr>\n<tr>\n<td><strong>Autogrow of Log3<\/strong><\/td>\n<td>&#160;<\/td>\n<td><strong>Autogrow of Log4<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\n  <br \/>We can see the first log file, FileID=2, grows before the log rollover from Log3, FileID=4, occurs to Log4, FileID=5, making space available in the first log file for the rollover when FileID=5 becomes full.&#160; Log records are written all four of the log files before the log wraps back around to the first log file, debunking point numbers two and four of the conclusion.&#160; The timestamps of the events shows that the additional log files are written to serially and not at the same time debunking point number three of the conclusion.&#160; The reason that only a fraction of the log records are written to the three additional log files is proportionate to the difference in the autogrowth settings between the first log file at 32MB and the three additional log files at 1MB.&#160; If the first log file was set to grow at 1MB, the majority of the log records would not be in the first log file.<\/p>\n<p>Its been well documented that there is no performance benefit to having multiple log files in a database, and Paul Randal\u2019s blog post, <a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/importance-of-proper-transaction-log-size-management\/\">Importance of proper transaction log size management<\/a>, was linked to in the original blog post that ultimately triggered this post.&#160; The behavior demonstrated in this post isn\u2019t a mystery, its documented in the Books Online (<a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/ms179355.aspx\">Transaction Log Physical Architecture<\/a>), but sometime empirical evidence like this helps solidify that fact.&#160; <\/p>\n","protected":false},"excerpt":{"rendered":"<p>While working on yesterday\u2019s blog post The Future \u2013 fn_dblog() No More? Tracking Transaction Log Activity in Denali I did a quick Google search to find a specific blog post by Paul Randal to use it as a reference, and in the results returned another blog post titled, Investigating Multiple Transaction Log Files in SQL [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,38,45],"tags":[],"class_list":["post-541","post","type-post","status-publish","format-standard","hentry","category-extended-events","category-sql-server-2008","category-xevent-a-day-series"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>An XEvent a Day (23 of 31) \u2013 How it Works \u2013 Multiple Transaction Log Files - Jonathan Kehayias<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"An XEvent a Day (23 of 31) \u2013 How it Works \u2013 Multiple Transaction Log Files - Jonathan Kehayias\" \/>\n<meta property=\"og:description\" content=\"While working on yesterday\u2019s blog post The Future \u2013 fn_dblog() No More? Tracking Transaction Log Activity in Denali I did a quick Google search to find a specific blog post by Paul Randal to use it as a reference, and in the results returned another blog post titled, Investigating Multiple Transaction Log Files in SQL [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\/\" \/>\n<meta property=\"og:site_name\" content=\"Jonathan Kehayias\" \/>\n<meta property=\"article:published_time\" content=\"2010-12-23T19:33:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-13T16:18:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/6e91e8be\/image_thumb.png\" \/>\n<meta name=\"author\" content=\"Jonathan Kehayias\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jonathan Kehayias\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"18 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\\\/\"},\"author\":{\"name\":\"Jonathan Kehayias\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/#\\\/schema\\\/person\\\/01c10d94f3648654ef706d5e6305f69c\"},\"headline\":\"An XEvent a Day (23 of 31) \u2013 How it Works \u2013 Multiple Transaction Log Files\",\"datePublished\":\"2010-12-23T19:33:00+00:00\",\"dateModified\":\"2017-04-13T16:18:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\\\/\"},\"wordCount\":2261,\"commentCount\":2,\"image\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.SQLskills.com\\\/blogs\\\/jonathan\\\/wp-content\\\/uploads\\\/windowslivewriter\\\/070b533d037c\\\/6e91e8be\\\/image_thumb.png\",\"articleSection\":[\"Extended Events\",\"SQL Server 2008\",\"XEvent a Day Series\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\\\/\",\"url\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\\\/\",\"name\":\"An XEvent a Day (23 of 31) \u2013 How it Works \u2013 Multiple Transaction Log Files - Jonathan Kehayias\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.SQLskills.com\\\/blogs\\\/jonathan\\\/wp-content\\\/uploads\\\/windowslivewriter\\\/070b533d037c\\\/6e91e8be\\\/image_thumb.png\",\"datePublished\":\"2010-12-23T19:33:00+00:00\",\"dateModified\":\"2017-04-13T16:18:28+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/#\\\/schema\\\/person\\\/01c10d94f3648654ef706d5e6305f69c\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.SQLskills.com\\\/blogs\\\/jonathan\\\/wp-content\\\/uploads\\\/windowslivewriter\\\/070b533d037c\\\/6e91e8be\\\/image_thumb.png\",\"contentUrl\":\"https:\\\/\\\/www.SQLskills.com\\\/blogs\\\/jonathan\\\/wp-content\\\/uploads\\\/windowslivewriter\\\/070b533d037c\\\/6e91e8be\\\/image_thumb.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Extended Events\",\"item\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/category\\\/extended-events\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"An XEvent a Day (23 of 31) \u2013 How it Works \u2013 Multiple Transaction Log Files\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/#website\",\"url\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/\",\"name\":\"Jonathan Kehayias - The Rambling DBA\",\"description\":\"The Rambling DBA\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/#\\\/schema\\\/person\\\/01c10d94f3648654ef706d5e6305f69c\",\"name\":\"Jonathan Kehayias\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/86630e27f5deecc5c393ea57fc7c3b6a068949f4fd6b5309f81de5a276f12855?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/86630e27f5deecc5c393ea57fc7c3b6a068949f4fd6b5309f81de5a276f12855?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/86630e27f5deecc5c393ea57fc7c3b6a068949f4fd6b5309f81de5a276f12855?s=96&d=mm&r=g\",\"caption\":\"Jonathan Kehayias\"},\"sameAs\":[\"http:\\\/\\\/3.209.169.194\\\/blogs\\\/jonathan\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"An XEvent a Day (23 of 31) \u2013 How it Works \u2013 Multiple Transaction Log Files - Jonathan Kehayias","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\/","og_locale":"en_US","og_type":"article","og_title":"An XEvent a Day (23 of 31) \u2013 How it Works \u2013 Multiple Transaction Log Files - Jonathan Kehayias","og_description":"While working on yesterday\u2019s blog post The Future \u2013 fn_dblog() No More? Tracking Transaction Log Activity in Denali I did a quick Google search to find a specific blog post by Paul Randal to use it as a reference, and in the results returned another blog post titled, Investigating Multiple Transaction Log Files in SQL [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\/","og_site_name":"Jonathan Kehayias","article_published_time":"2010-12-23T19:33:00+00:00","article_modified_time":"2017-04-13T16:18:28+00:00","og_image":[{"url":"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/6e91e8be\/image_thumb.png","type":"","width":"","height":""}],"author":"Jonathan Kehayias","twitter_misc":{"Written by":"Jonathan Kehayias","Est. reading time":"18 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\/#article","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\/"},"author":{"name":"Jonathan Kehayias","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/#\/schema\/person\/01c10d94f3648654ef706d5e6305f69c"},"headline":"An XEvent a Day (23 of 31) \u2013 How it Works \u2013 Multiple Transaction Log Files","datePublished":"2010-12-23T19:33:00+00:00","dateModified":"2017-04-13T16:18:28+00:00","mainEntityOfPage":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\/"},"wordCount":2261,"commentCount":2,"image":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\/#primaryimage"},"thumbnailUrl":"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/6e91e8be\/image_thumb.png","articleSection":["Extended Events","SQL Server 2008","XEvent a Day Series"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\/","url":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\/","name":"An XEvent a Day (23 of 31) \u2013 How it Works \u2013 Multiple Transaction Log Files - Jonathan Kehayias","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\/#primaryimage"},"image":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\/#primaryimage"},"thumbnailUrl":"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/6e91e8be\/image_thumb.png","datePublished":"2010-12-23T19:33:00+00:00","dateModified":"2017-04-13T16:18:28+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/#\/schema\/person\/01c10d94f3648654ef706d5e6305f69c"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\/#primaryimage","url":"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/6e91e8be\/image_thumb.png","contentUrl":"https:\/\/www.SQLskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/070b533d037c\/6e91e8be\/image_thumb.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-23-of-31-how-it-works-multiple-transaction-log-files\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/"},{"@type":"ListItem","position":2,"name":"Extended Events","item":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/category\/extended-events\/"},{"@type":"ListItem","position":3,"name":"An XEvent a Day (23 of 31) \u2013 How it Works \u2013 Multiple Transaction Log Files"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/","name":"Jonathan Kehayias - The Rambling DBA","description":"The Rambling DBA","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/#\/schema\/person\/01c10d94f3648654ef706d5e6305f69c","name":"Jonathan Kehayias","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/86630e27f5deecc5c393ea57fc7c3b6a068949f4fd6b5309f81de5a276f12855?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/86630e27f5deecc5c393ea57fc7c3b6a068949f4fd6b5309f81de5a276f12855?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/86630e27f5deecc5c393ea57fc7c3b6a068949f4fd6b5309f81de5a276f12855?s=96&d=mm&r=g","caption":"Jonathan Kehayias"},"sameAs":["http:\/\/3.209.169.194\/blogs\/jonathan"]}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/posts\/541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/comments?post=541"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/posts\/541\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/media?parent=541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/categories?post=541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/tags?post=541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}