sql server - is insert-select statement massive? -
when multiple inserts used select
statement in transaction, how database keep track of changes during transaction? can there problems resources (such memory or hard disk space) if transaction held open long?
you can have many problems large transaction. first, in databases not want run row-by-row because million records take hours. insert million records in 1 complex statement can cause locking on tables involved , harm performance else. , rollback if kill transaction can take while too. best alternative loop in batches. test 50,000 @ time , raise or lower set depending on how long takes. i've had databases no more 1000 in 1 set-based operation. if possible large inserts or updates should scheduled off-peak hours database operates. if large (and one-time - large data migration) might want close database maintenance, put in single user mode , drop indexes, insert , reindex.
Comments
Post a Comment