does the databases actually update

  • I have been told that when you run a sql statement on a database, it doesn't actually update the table. It's committed to a log. Is this true ?

  • swchoi.choi (3/30/2015)


    I have been told that when you run a sql statement on a database, it doesn't actually update the table. It's committed to a log. Is this true ?

    Think this question is best answered by referring to ACID

    😎

  • That's right and wrong at the same time. :hehe:

    Every modification to a database (in SQL Server) is part of a transaction. Each transaction (which can contain several statements) will be written to the transaction log and will be written to the disk to affect the database when the transaction is committed.

    Of course, this is very simplistic, but I'm searching for the full explanation of how this happens.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • No, the data gets updated AND the log gets written. As was stated above, this is to help maintain ACID properties and it makes it possible to do point in time recovery. But both events occur. For more details on how it occurs, I'd suggest getting Kalen Delaney's book on SQL Server internals.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply