Skip to content
HN On Hacker News ↗

FastBCP 1.6: Export Tables from SQL Server Backups

▲ 26 points • 5 comments • by rferraton • 3w ago • HN discussion ↗

Pangram verdict · v3.3

We believe that this text is a mix of AI and human-written content.

63 %

AI likelihood · overall

Mixed
37% human-written 63% AI-generated
SEGMENTS · HUMAN 3 of 27
SEGMENTS · AI 20 of 27
WORD COUNT 1,490
PEAK AI % 100% · §1
Analyzed
Nov 5
backend: pangram/v3.3
Segments scanned
27 windows
avg 55 words each
Distribution
37 / 63%
human / AI fraction
Verdict
Mixed
Pangram v3.3

Article text · 1,490 words · 27 segments analyzed

Human AI-generated
§1 AI · 100%

TL;DRFastBCP 1.6 exports a table from a SQL Server full backup to Parquet, with no restore and no SQL Server instance. On a 320 GB production backup, the first open took 2 min 29 s and later ones 0.3 s. With 24 threads, a 175-million-row table then went to Parquet in 29.6 seconds. FastTransfer can load the files into SQL Server, on any version, or into PostgreSQL. FastBCP 1.6 reads a table straight out of a SQL Server full backup. You point it at a .bak file, name a table, and get Parquet files. There is no restore, no SQL Server instance, and no credentials to manage. Parquet is the only output for now. That is enough to close the loop, though: FastTransfer loads those files into the SQL Server instance of your choice, and that instance can run an older version than the one that took the backup.

§2 AI · 100%

RESTORE cannot do that.

§3 AI · 100%

A first export The new connection type is backup_mssql. --server is the directory that holds the backups.

§4 AI · 100%

--database is the backup file, or a pattern that matches it (tpch_*.bak for a striped backup).

§5 AI · 100%

The stripes can also be listed, separated by ;.

§6 Human · 0%

WindowsLinux.\FastBCP.exe ` --connectiontype backup_mssql ` --server "D:\Backups\MSSQL" ` --database "tpch_full.bak" ` --sourceschema "dbo" ` --sourcetable "orders" ` --directory "D:\export\orders" ` --fileoutput "orders.parquet" ` --parallelmethod Physical ` --paralleldegree 8 With a backup as the source, --parallelmethod Physical cuts the table into as many slices as --paralleldegree.

§7 AI · 100%

Each thread reads its own slice and you get one file per chunk (orders_chunk_000.parquet, orders_chunk_001.parquet…). To export a subset of columns, use --query with a column list: SELECT o_orderkey, o_orderdate FROM dbo.orders. That is the whole grammar, SELECT * | col1, col2, … FROM [schema.]table.

§8 AI · 100%

A WHERE clause is not accepted. Here is where the files go next: What it reads The driver behind backup_mssql, ArpeMSBackup, reads the backup file on its own, with no SQL Server component involved.

§9 Human · 0%

SQL Server versions2017201920222025Backup kindsFullCopy-only fullSeveral backups in one fileBackup compressionNoneMS_XPRESSZSTDAny block sizeStriped backupsPatternListAny orderDatabase layoutSeveral data filesSeveral filegroupsRowstore tablesHeapsClustered indexesPartitionsData compressionColumnstore tablesClustered columnstoreArchive compressionOpen delta storeDeleted rows Data types bigint✓int✓smallint✓tinyint✓bit✓decimal✓numeric✓money✓smallmoney✓float✓real✓date✓time✓datetime✓datetime2✓smalldatetime✓datetimeoffset✓char✓varchar✓varchar(max)✓nchar✓nvarchar✓nvarchar(max)✓text✓ntext✓binary✓varbinary✓varbinary(max)✓image✓uniqueidentifier✓rowversion✓xml✓sql_variant✓hierarchyid✓geography✓geometry✓vector(n)✓vector(n, float16)✗json✗ The full mapping is in the datatypes conversion page.

§10 Mixed · 53%

Restrictions Full backups onlyCopy-only included.

§11 AI · 100%

Differential and log backups are not applied.

§12 AI · 100%

A file that holds no full backup is refused.No encryptionBackups of TDE databases and encrypted backups (WITH ENCRYPTION) are refused: their pages cannot be read without the server certificate.No QAT_DEFLATEBackups compressed with Intel QuickAssist are not supported.

§13 Mixed · 34%

MS_XPRESS and ZSTD are.Parquet output onlyOn Windows x64 and Linux x64. One more thing to keep in mind: a RESTORE replays the part of the transaction log stored in the backup to make the database consistent.

§14 Mixed · 60%

FastBCP does not.

§15 AI · 100%

If a table was being written to while the backup ran, you get its pages as they were copied. For an exact image, back up while the table is quiet.

§16 AI · 100%

Use cases Restore n-tables Someone dropped a table, or needs last Tuesday's version of it.

§17 AI · 100%

The usual answer is to restore the whole database next to production, which means as much free disk as the database and hours of restore for a 2 TB backup, all to get one table back. With FastBCP and FastTransfer, you export that one table from the backup and load it wherever you want: a scratch database, the production server under another name, or an instance running an older version. SQL Server cannot restore a backup on an older version than the one that created it, while Parquet files do not care.

§18 AI · 100%

The load step uses FastTransfer, one chunk per Parquet file.

§19 AI · 100%

The target table must exist.

§20 Human · 0%

WindowsLinux.\FastTransfer.exe ` --sourceconnectiontype duckdbstream ` --sourceserver ":memory:" ` --query "SELECT * EXCLUDE filename FROM read_parquet('D:\export\orders\*.parquet', filename=true)" ` --targetconnectiontype msbulk ` --targetserver "sql2019\restore" ` --targetdatabase "tpch_restore" ` --targettrusted ` --targetschema "dbo" ` --targettable "orders" ` --loadmode Truncate ` --mapmethod Name ` --parallelmethod DataDriven ` --distributekeycolumn "filename" ` --datadrivenquery "SELECT file FROM glob('D:\export\orders\*.parquet')" ` --degree 8 Migrations A migration starts with a bulk copy of the existing data.

§21 AI · 100%

Reading it from last night's full backup puts no load on the source server, and the backup is often already on a share the migration team can reach. If you have to stay on a newer-to-older path, Parquet removes the version constraint too. Say you are moving from SQL Server to PostgreSQL. FastBCP exports each table from the backup to Parquet, then FastTransfer loads the files through PostgreSQL's COPY protocol: Run this pair of commands once per table. Create the target tables first: FastTransfer loads into tables that already exist.

§22 AI · 100%

WindowsLinux.\FastBCP.exe ` --connectiontype backup_mssql ` --server "D:\Backups\MSSQL" ` --database "tpch_full.bak" ` --sourceschema "dbo" ` --sourcetable "orders" ` --directory "D:\export\orders" ` --fileoutput "orders.parquet" ` --parallelmethod Physical ` --paralleldegree 8.\FastTransfer.exe ` --sourceconnectiontype duckdbstream ` --sourceserver ":memory:" ` --query "SELECT * EXCLUDE filename FROM read_parquet('D:\export\orders\*.parquet', filename=true)" ` --targetconnectiontype pgcopy ` --targetserver "pgserver:5432" ` --targetdatabase "tpch" ` --targetuser "FastUser" ` --targetpassword "FastPassword" ` --targetschema "public" ` --targettable "orders" ` --loadmode Truncate ` --mapmethod Name ` --parallelmethod DataDriven ` --distributekeycolumn "filename" ` --datadrivenquery "SELECT file FROM glob('D:\export\orders\*.parquet')" ` --degree 8 The final cutover can use the same path: stop the application, take a COPY_ONLY full backup, export, load.

§23 AI · 100%

With the application stopped, the backup is consistent and no log replay is needed. Whether it beats a direct transfer depends on the size of the database and on the cutover window, so measure both. Feeding a data warehouse or a data lake Most production databases are backed up every night, and those backups already sit somewhere outside production. FastBCP can turn them into Parquet files for a data lake, or for a warehouse load, without opening a single connection to production. No read replica, no extraction window, no read locks on busy tables. Why it is fast Straight to the table The driver reads the backup as a plain binary file. It understands it well enough to go straight to the data of the requested table and skip everything else in the file. Values are decoded straight into Apache Arrow columns, which FastBCP writes to Parquet. The first export from a backup pays a one-time cost: the whole file is read once, decompressed if needed, so the driver can find its way in it. FastBCP keeps what it learned in a small local cache. The next exports from the same backup, whatever the table, skip that step. On the 320 GB production backup measured below, the first open took 2 min 29 s and the next ones 0.3 s. A new backup file gets a fresh read. Parallel reads, when you want them With --parallelmethod Physical, each thread takes its own share of the table. All threads work on the same opened backup, so it is opened once whatever the degree. For a compressed backup, they also share the decompressed data. No locks, no latches There is no lock manager, no buffer latch, no other session, and no SQL Server process. A thread reads its pages and nothing waits on anything. The production server does not see the export at all. Memory does not grow with the backup The backup is read in place and is never loaded into memory. Data goes once from the file to an Arrow batch. What stays in memory is a small amount of metadata, one batch per thread and, for a compressed backup, a shared decompression cache (256 MB by default). Exporting a 15-million-row rowstore table with 8 threads peaked at 674 MB for the whole FastBCP process from the uncompressed backup, 979 MB from the ZSTD one. Columnstore tables are the exception, and today the weak spot: a rowgroup of up to a million rows is decoded whole, so memory grows with the number of threads and the number of columns. On the real tables below, 24 threads peaked at 26 GB for 62 columns and 44 GB for 124 columns, where the live export of the same table stayed at 4.5 GB.

§24 AI · 100%

We are working on it. Until then, lower --paralleldegree on a machine with less memory. Update: FastBCP 1.6.5FastBCP 1.6.5 keeps memory bounded on columnstore tables. Exporting a wide clustered columnstore table with 8 threads peaked at 42 GB before this version and peaks at 5.9 GB with it. The figures in this article were measured with 1.6.3 and 1.6.4. See the release notes.

§25 AI · 100%

infoThe speed depends on two things: how fast your disk reads, and how fast the export tool decodes and writes. A local NVMe drive delivers several GB/s and a decent SSD several hundred MB/s. A USB key, or a small cloud disk whose throughput is tied to its size, will be the bottleneck.

§26 AI · 100%

On a good disk, the limit is the export tool, and that is the part FastBCP is built for.

§27 Mixed · 34%

Performance Real columnstore tables, FastBCP 1.6.3 These runs come from a real production database, not a benchmark schema: two clustered columnstore tables, one with 62 columns and one with 124, both well over 100 million rows.