Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

Refreshing a table using CREATE TABLE, DROP and Rename

$
0
0

A read-only database (database1) is updated via log shipping every minute, then a procedure queries multiple tables in it and refreshes a large table on database2.

For this process I

  • run an "expensive" query against database1 and generate a new Table in database2 (Table_A_TEMP)

    BEGIN TRAN
    DROP TABLE Table_A
    RENAME Table_A_TEMP to Table_A
    COMMIT
    

Does it look too ugly? Otherwise I would have to create a very complex verifications and updates.

Suggestions to minimize locks?


Viewing all articles
Browse latest Browse all 17268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>