Database Snapshots

  • Hi, quick question on Database Snapshots. Let's say I take a snapshot once per hour, and I update a row in a table and so the original row is copied to the snapshot. Then that same row in that table is updated for a second time, is will the snapshot be able to capture more then one change on the same row?

    Also, are there recommendations on frequency of snapshots?

    Thanks!!

  • No.

    A shapshot only preserves the state at the moment it has been taken !

    So it only contains a single truth about a row at a certain point in time.

    Keep in mind a snapshot database will consume as much space as the original rows need (+ a little bit). (only the ones that got updated !)

    snapshot 1 will have the original state of rowA.

    Snapshot 2 will have the next state of rowA.

    Then RowB will get updated and will be documented in both snapshot databases !

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Just bear in mind that snapshots aren't free. Having lots of them could slow down inserts, updates and deletes.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Ok, so snapshot 1 is taken at 12pm, provides a copy of the database, RowA at that point in time.

    Row A is modified at 12:15pm, snapshot 1 will not capture that update?

    Row A is again modified at 12:30pm

    Snapshot 2 is taken at 1pm, snapshot 2 will capture both Row A mods, 12:15pm + 12:30pm. Snapshot 1 would only capture mods prior to 12pm?

  • Snapshots don't capture modifications. They show the database as it was at the time the snapshot was created. So, in your scenario, if you query snapshot 1, it will show Row A as it was at 12:00, if you query snapshot 2, it will show Row A as it was at 13:00

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • got it, thanks Gail!

  • In fact a snapshot db is created without any entries !

    Data is only inserted if rows are modified in the originating database (or objects altered/dropped).

    That's why a snapshot db only grows accordingly to the modification rate of the original db.

    Off course there is a system overhead and a snapshot db is read only (for the user) !

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

Viewing 7 posts - 1 through 6 (of 6 total)

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