tsql - MERGE vs DROP Table and Rebuild Indexes in SQL Server -


i have "log shipped" copy of database lives @ third party. log shipping runs every 15 minutes @ time connections database dropped. database used reporting purposes.

i have decided pull of data log shipped (read only) database new database refreshed nightly. allow users connect new database without risk of loosing connectivity due log shipping. (it allows more granular security permissions used, since read-only copy can't edited)

i can think of 2 patterns accomplish this.

  1. drop table, create table, create indexes
  2. use merge statement insert/update/delete records

i have implemented solution using method 1 above, , works fine.

it feels bit heavy me drop of data every day. there side effects method 1 above should push me on using method 2?

to provide sense of scale, syncing 3 tables,

table 1 - 38 columns - 13,110 rows table 2 - 82 columns - 17,421 rows table 3 - 22 columns - 249 rows 

the resulting database ~1.3 gb. (there other tables in there well)

i appreciate guidance on method 1 vs 2, , whether there method not thinking about.

truncate , insert more efficient either dropping or merging.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -