I am using EF 6.1.1, and my database has three million records and migration has to change the precision of a column of type decimal
. And the migration timeout window set to max value, CommandTimeout = Int32.MaxValue;
I was testing this scenario in Azure SQL Server, and after trying around 90 minutes it ends up with an exception, but no migration done on database.
Exception details:
The session has been terminated because of excessive transaction log space usage. Try modifying fewer rows in a single transaction.
My questions are:
Is it the expected behavior to take more time for migration of this type on a huge DB? (because after changing the precision it has to convert the existing value and save it back, and it has to be repeated on 3 million records)
How to resolve this? I don't think we can have migration in chunks of transactions.
You get this error because you are running out of transaction log space. Your transaction log is likely filling up because you are doing this in one transaction. Depending on the number of columns in your table the transaction log can take up considerable disk space for 3,000,000 records. The easiest solution, if possible, is temporarily allocate more disk space to your transaction log. Alternatively you could consider batching your migration, although point 2 suggests this is not an acceptable solution for you.