SqlPackage.exe takes a long time
So, we are working on adding SQL DACPACs as part of our ongoing integration. We do this with a powershell script running "sqlpackage.exe" with each DacPac file. we have about 12 databases, so about 12 DacPacs.
Every time we run "sqlpackage.exe" to publish or script DacPac, we notice that it takes 0.5-1 + minutes to complete initialization. Most of this time is done during the init thread when "sqlpackage.exe" starts.
I am trying to find a way to reduce this if possible, since we have 12 DBs that we talk about at least 12 minutes to deploy the DB, which is too much for us.
Do you know how you can reduce this?
source to share
The time I believe is being used to get the current schema from the database, compare it with the one in dacpac, and come up with the necessary change scripts. There is no way to fix this with dacpac.
However, you could do this ahead of time if SqlPackage generates the upgrade scripts and then simply run the scripts when deployed. This can reduce the downtime to all the time it takes to run the script and, as suggested, when running in parallel, the downtime can be significantly reduced.
If all your DBs are guaranteed to be in the same state (schema), you can simply create one update script from the first DB and run it on all DBs.
source to share