I've been doing backups of my SQL Server 2014 Express databases for import to other servers and noticed a difference in file size between .bacpac and .bak . Why is a .bacpac file so small compared to a .bak file of the same database? Thanks for any insights!
8,982 6 6 gold badges 45 45 silver badges 51 51 bronze badges asked May 9, 2016 at 12:48 673 1 1 gold badge 5 5 silver badges 5 5 bronze badgesA BACPAC is not a substitute for a FULL backup. Its just a snapshot that can be used to move a database from one server to another (or to cloud) and archiving an existing database in an open format.
From my test, below are the results
I'd assume there's no index data in the .bacpac either, which is likely to be a BIG contributor to file size.
Commented Mar 13, 2017 at 10:42Why do you say that is it not a substitute for a FULL backup please? And what exactly is the purpose of doing a BACPAK file please?
Commented Apr 20, 2022 at 12:04A backup created via the BACKUP DATABASE command ( .bak ) is a page-by-page copy of a database. Note that SQL Server database contains not only data pages. There are also pages with indexes that can be large. More details here
A backup created using the Export Data-Tier Application ( .bacpac ) operation is simply an exported rows from a database in XML format placed in an archive. You can manually view the contents of BACPAC, just change the extension of this file to .zip.
The size of the .bacpac file is directly proportional to the number of records in a database (taking into account the compression ratio).
The size of the .bak file depends not only on the data but also on the size of the indexes.
Sometimes this can be a problem, check for example this old discussion
Therefore, the .bacpac file is usually smaller in size.
I ran the simplest tests with the AdventureWorks database and got these results.
AdventureWorks.bacpac - 17 mb AdventureWorks.bacpac.zip - 16 mb AdventureWorks_with_compression.bak - 49 mb AdventureWorks_with_compression.bak.zip - 47 mb
Should I use .bacpac to reduce my backup size?
No.
Export \ Import Data Tier Application has several significant drawbacks that are critical for large databases:
Classic backup created using the BACKUP DATABASE command is devoid of these drawbacks, to save space use Point-in-time recovery
Export \ Import data-tier application can be considered as a way to create a backup only for small databases, in those cases when you do not have access to the file system. In this case, do not export the live database under any circumstances, be sure to create a snapshot for consistent export.