SQL Server Concurrency issue -


i’ve report sits on top of view. view underlying tables updated every 15 minutes , update cycle takes approximately 1 -2 minutes , during time if run report i’m getting wrong values on report .is there way can apply kind of locks on view can report once update done , avoid dirty data on report.please let me know if there other solution issue

thanks, ravi

i consider using different method update underlying tables. instead of updating these tables 1-2 minutes, make "shadow" tables in schema. (and have third schema temporary holding.) allows work on tables users can't see, switch them in using metadata operation. can this:

  1. truncate/re-populate shadow tables (2 minutes, or maybe less no contention)
  2. start transaction (sub-millisecond)
  3. move primary table holding schema, using alter schema ... transfer (sub-millisecond)
  4. move shadow table dbo schema (sub-millisecond)
  5. move primary table shadow schema (sub-millisecond)
  6. commit transaction (sub-millisecond)
  7. (optional) truncate shadow table recover space (sub-second)

one downside of solution have 2 sets of stats, indexes etc. maintain. stats should ok if data increasing , not changing substantially otherwise.

adam haines has thorough write-up method (which showed him few years ago) here:

http://jahaines.blogspot.com/2009/10/locking-table-while-it-is-being-loaded.html


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -