Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6154763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:18:58+00:00 2026-05-23T20:18:58+00:00

In SQL Server 2008, I would like to examine what is really going on

  • 0

In SQL Server 2008, I would like to examine what is really going on behind the scenes when a query is executed. Can I somehow see the following?

  1. The number of (and maybe even the content of) the log records “produced” by a query.
  2. When the contents of the log is actually applied to the real data structures. For example:
    1. when are new rows actually added to the (clustering) index structure?
    2. and did the update/insertion imply a B-tree re-organization (and if so, how large part of that B-tree (how many pages) were affected in that)? Hmm, maybe I should have posted a separate question about this…
  3. Number of buffer misses/hits for each accessed table.
  4. The contents of the buffer (which, or how many, pages from the table are currently in the buffer)?

BTW: I considered splitting this question up in multiple smaller questions, but I guess they are somewhat quite related.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:18:59+00:00Added an answer on May 23, 2026 at 8:18 pm

    Here is a simple demo script to start your journey into learning about the SQL Server Internals. To see the individual actions of a query go to Paul Randal’s SQLSkills Blog.

    Other posts on this blog will cover topics like DBCC PAGE which will allow you to see the contents of the PAGE and DBCC IND which will show you the allocation maps for tables/indexes. I recommend reading a copy of Microsoft SQL Server 2008 Internals which covers all of these topics in detail.

    Transaction Log Records Demo Script

    For the two Selects the misses are shown as the physical reads and read-ahead reads, these are the reads from disk into the buffer pool. The query engine then uses these pages and this is the logical reads. So for the io stats on the warm select it has no physical reads or read-ahead reads so all the pages required where already in the the buffer pool.

    /* -- Cleanup Script
    USE master
    DROP DATABASE ExampleDB
    */
    SET NOCOUNT ON
    SET STATISTICS IO OFF
    GO
    CREATE DATABASE ExampleDB
    GO
    USE ExampleDB
    GO
    -- Force a CHECKPOINT to CLEAR the Transaction Log
    CHECKPOINT
    GO
    -- Show Empty Transaction Log
    SELECT * FROM fn_dblog(NULL,NULL)
    GO
    -- CREATE SIMPLE TABLE
    CREATE TABLE NewTable
    (
        A   int identity NOT NULL PRIMARY KEY,
        B   char(8000) NOT NULL DEFAULT ('')
    )
    GO
    -- Show Transaction Log With CREATE TABLE records
    SELECT * FROM fn_dblog(NULL,NULL)
    GO
    -- Force a CHECKPOINT to CLEAR the Transaction Log
    CHECKPOINT
    GO
    PRINT 'INSERT Start'
    GO
    INSERT  NewTable
    VALUES (DEFAULT)
    GO 1000
    PRINT 'INSERT End'
    GO
    -- Show Transaction Log With INSERT records
    SELECT * FROM fn_dblog(NULL,NULL)
    GO
    -- Turn On IO Statistics (these appear in the messages tab)
    SET STATISTICS IO ON
    GO
    -- Force a CHECKPOINT to CLEAR the Transaction Log and modified buffer pages
    CHECKPOINT
    GO
    -- DROP CLEAN BUFFERS to empty cache
    DBCC DROPCLEANBUFFERS
    GO
    PRINT 'SELECT Start Cold Cache'
    GO
    SELECT * FROM NewTable
    GO
    PRINT 'SELECT End Cold Cache'
    GO
    PRINT 'SELECT Start Warm Cache'
    GO
    SELECT * FROM NewTable
    GO
    PRINT 'SELECT End Warm Cache'
    GO
    -- Force a CHECKPOINT to CLEAR the Transaction Log
    CHECKPOINT
    GO
    DROP TABLE NewTable
    -- Show Transaction Log With DROP TABLE records
    SELECT * FROM fn_dblog(NULL,NULL)
    GO
    

    For the contents of the buffer pool the starting point is this DMV

    SELECT      *
    FROM        sys.dm_os_buffer_descriptors
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using SQL Server 2008 and would really like to know how the
I would like to query for all databases (in SQL Server 2008 instance) date
I'm using SQL Server 2008 and I would like to use a sproc to
using sql server 2008 I would like to take a table that has 11
In SQL Server 2008 I would like to create a stored procedure to select
In SQL Server 2008, I would like to add a column to a table
I am using SQL Server 2008, and would like to be able to take
I would like to generate a Data Dictionary for a SQL Server 2008 database
I'm using Visual Studio 2008 and SQL Server 2008. I would like .sql files
I only have SQL Server 2008 Client tools. I would like to use Spy++

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.