SQL Server and PostgreSQL Backup: Modes, Plugins, Performance and the State of the Art
Database backup has a requirement that file backup does not: the copy has to be consistent with the transactions that were in flight at the moment it was taken, and the restore has to be able to stop at an exact point, such as 2:32 PM on a Tuesday, before an application error or an accidental deletion. Anyone who has been through a database restore knows that the time to get back depends on the chain of backup files, on the logs available and on tests done before the incident.
This guide collects what the database team and the infrastructure team need to agree on. We start with the database backup methods and their concepts, then detail how the NGBackup SQL Server and PostgreSQL plugins work, with their modes, options and restore, explain how to tune performance and describe a recommended architecture that includes the restore test.
Why databases need their own backup
Copying the disks of the machine that hosts the database produces, in the best case, a crash-consistent copy: when the database starts from it, it goes through crash recovery as it would after a power failure. For many databases that is enough as a second line of defense. For the primary backup, three needs are left out.
- Recovery to a point in time: bringing the database back to exactly the moment before the error requires the sequence of transaction logs, which a disk copy does not preserve.
- Granularity: restoring a database, a table or an object without restoring the whole machine.
- Verification: checking the integrity of the copy, with checksums and consistency tests, before it is needed.
That is why NGBackup handles databases with native plugins, which talk to the database engine itself and use its backup mechanisms.
Database backup methods
Two numbers guide the whole choice. RPO is the maximum amount of data the company accepts to lose, measured in time, and RTO is the maximum time accepted for the database to come back. The table below summarizes the most common methods and what each one offers.
| Method | How it works | Strengths | Points of attention |
|---|---|---|---|
| Logical dump (pg_dump, mysqldump) | Exports the structure and the data as SQL commands or a proprietary format. | Portable across versions and platforms; good for migrations. | On large databases the export and the import are slow; it represents a single point in time. |
| Full physical backup | Copies the database pages through the native mechanism (BACKUP DATABASE, pg_basebackup). | Fast restore; the basis for recovery chains. | Takes the full volume on every run. |
| Differential | Copies the pages changed since the last full. | Shortens the restore chain. | Grows over the cycle between two fulls. |
| Block-level incremental | Copies only the blocks changed since the previous backup. | Short windows on large databases. | Depends on engine support (for example, PostgreSQL 17). |
| Transaction logs (WAL) | Keeps the sequence of changes between full backups. | Point-in-time recovery and an RPO of minutes. | Requires an intact log chain and archiving configured. |
| Storage snapshot | Snapshot of the volume, coordinated with the database. | Almost instantaneous. | Requires coordination with the database and stays on the same storage. |
In practice, corporate environments combine methods: a periodic full physical backup, differentials or incrementals in the middle of the cycle and frequent logs for the RPO. The rest of this guide shows how NGBackup delivers that combination on each engine.
SQL Server with NGBackup
Architecture and versions
The SQL Server plugin consists of a library loaded by the NGBackup client and a helper process, mssql-backend, which runs the commands on SQL Server and streams the data to the Storage Daemon. There are versions for Windows and for Linux. On Linux, the plugin supports SQL Server 2017, 2019 and 2022, and the documentation also covers Windows, from SQL Server 2012, and Azure SQL Managed Instance through backup to URL.
How the backup is made
The plugin uses the native SQL Server BACKUP DATABASE command, the same one the DBA would run by hand, and does not copy the .mdf and .ldf files while the database is open.
- On Linux, SQL Server writes the backup to a named pipe (FIFO), and the plugin reads from the pipe and streams to the Storage Daemon. There is no large intermediate file on disk.
- On Windows, the plugin generates the .bak file in a local temporary directory, streams it and removes it at the end. Reserve temporary space equal to the largest database in the job.
Backup levels and the restore chain
The job level in the Director maps to the SQL Server types: Full produces the full backup, Differential produces the differential and Incremental produces the transaction log backup.

The plugin tracks the chain of each database and protects against configuration mistakes. A Full backup automatically replaces the requested level in the situations below.
- A new database, with no full in the catalog yet.
- A broken chain, when the identifier of the recorded chain no longer matches the one of the database.
- A database in the SIMPLE recovery model, which does not generate transaction logs. The behavior is configurable through
simple_recovery_models_incremental_action. - The
mastersystem database, which is always copied in full.
Log files get the previous LSN in their name (log-<LSN>.trn), which allows the order of the chain to be rebuilt from the catalog. Read-only databases can be skipped with skipreadonly.
Performance and integrity options
| Option | What it does |
|---|---|
stripes | Splits the backup into 1 to 64 parallel streams, each sent to the Storage Daemon. |
parallel_dbs | How many databases are backed up at the same time. |
compress, compress_level | Compression: none, native, zstd, lz4, gzip or native+zstd (default), with level 3 by default. |
buffercount, maxtransfersize, blocksize | Fine tuning of the BACKUP DATABASE buffers, important on large databases. |
max_rate_kbps | Limits the throughput, to protect production at peak hours. |
checksum | Backup with WITH CHECKSUM, enabled by default. |
verify_backup | Runs RESTORE VERIFYONLY at the end of the backup. |
dbcc_checkdb | Consistency check: no, physical_only or full. |
copyonly | COPY_ONLY backup, which does not change the differential base. |
include, exclude, include_system_dbs | Database selection. By default master, msdb and model are included, and tempdb is always left out. |
Restore
The plugin reapplies the chain in order: the full, the differential and each log in ascending LSN order. All steps except the last use NORECOVERY, and the last one leaves the database available. The stop-point options (stop_at, stop_at_mark and stop_before_mark) apply to the last log, with UTC as the default time zone.
| Mode | Use |
|---|---|
in_place | Restores over the original database. |
new_db | Restores as a new database, with database= for the name, and is the path for the restore test. |
to_disk | Extracts the backup files to a directory, without restoring into SQL Server. |
single_item | Restores a temporary database, exports a table with bcp to data files and removes the temporary database. |
Other useful restore options: instance= for another instance, drop_existing= with the values no, yes or only_if_match, tail_log_before= to capture the end of the log before a destructive restore, file_relocation_map= to change file paths and dbcc_checkdb= and row_count_compare= to check the result after restoring.
Configuration example
Content {
Name = "SQL-Producao"
Include {
Plugin = "mssql: mode=tds_fifo hostname=localhost user=backupuser passfile=/etc/ngbackup/mssql.pass stripes=4 compress=native+zstd"
}
}restore jobid=2210 pluginoptions="mssql: authtype=sql user=backupuser database=Vendas_teste drop_existing=no" yesThe same Content can be built in the Content Studio of the web console, which shows the plugin string and the Content preview.

The first block protects the instance with four streams and compression. The second restores the backup of job 2210 as the Vendas_teste database, without overwriting an existing database.
Permissions and other features
The backup account needs BACKUP DATABASE, BACKUP LOG and VIEW SERVER STATE, and CONTROL SERVER when the TDE certificate is captured along with the backup (tde_capture=yes). For Always On, the plugin has the options ag_preference (auto, primary, secondary or readable_secondary) and ag_failover_retry. Environments with availability groups and TDE are in the scope of the pilot, to validate the behavior in your environment.
PostgreSQL with NGBackup
Architecture and versions
The PostgreSQL plugin runs on Linux x86_64 and follows the same design as the SQL Server one, with a library in the client and the postgresql-backend process running the commands. The documentation covers versions 12 to 17, and the plugin is validated in the lab with PostgreSQL 16 and 17. The logical backup can run from another machine, with host=, without installing the client on the database server.

Backup modes
The mode is chosen with mode=, and the default is dump.
dump: runspg_dumpper database, in custom format, streamed. On very large tables with a numeric primary key, the plugin splits the export into ranges and processes them in parallel (parallel_tablesandlarge_table_threshold). On restore, it usespg_restore --clean --if-exists --no-owner, drops and recreates indexes around the data load and runsANALYZEat the end.parallel_dump: processes several databases and several tables at the same time (parallel_dbsandparallel_tables, both 4 by default) from a consistent snapshot obtained withpg_export_snapshot().pitr: physical backup through the low-level API (pg_backup_startandpg_backup_stopon PostgreSQL 15 or later, and the equivalent functions on earlier versions), reading thePGDATAfiles and the tablespaces. The Full stores thePGDATAand the WALs of the backup interval, and the incremental stores the WALs archived since then. It requiresarchive_mode=onand a configuredarchive_command, and the plugin derives the archive directory from it.pitr_block: block-level incremental for PostgreSQL 17, withpg_basebackup --incrementalfrom the manifest of the previous backup. The restore reconstructs the incremental files in place, with no extra disk space.cdp: runspg_receivewalin frequent jobs, every 5 to 15 minutes, with optionalreplication_slot=. It is the option for an RPO of a few minutes.
Point-in-time restore
The restore of the pitr mode happens in six phases: preparation, receiving the files, recovery configuration, startup and monitoring, verification and cleanup.
- Preparation: PostgreSQL is stopped (
stop_postgresql_before_restore, enabled by default) and the currentPGDATAis moved toPGDATA.old.<date>, which is kept for 7 days by default (pgdata_backup_retain_days). - Receiving: the backup files are written to the new
PGDATA, and the WALs to the recovery directory. - Configuration: the plugin writes a block in
postgresql.auto.confwith therestore_commandand the recovery target, and creates therecovery.signalfile. - Startup: starting PostgreSQL at the end of the restore is controlled by
start_postgresql_after_restore, off by default. When it comes up, the server reapplies the WALs up to the target. - Verification: optional, with
verify_after_restore,verify_checksumsand a check SQL file inpost_restore_sql_file. - Cleanup: the restore process is shut down.
The recovery target can be a time, an LSN, a transaction ID or a named point (recovery_target_time, recovery_target_lsn, recovery_target_xid and recovery_target_name), and the restore_target_action option chooses between promote, pause and shutdown when it is reached. For tablespaces in other paths, tablespace_remap=OID:/path. To rehearse without changing anything, dry_run_restore.
Replicas, slots and authentication
- Backup from the replica: with
backup_from_standby=true, the plugin reads from a standby and the backup manifest records the source, which takes the read load off the primary. - Replication state: with
track_replication_state=true, slots and subscriptions are stored in the manifest, and the restore recreates the missing slots (restore_replication_state, enabled by default). - Authentication:
passwordorpassfile,service, the TLS options (sslmode,sslcert,sslkeyandsslrootcert) andpghostwith a socket path. When the backend runs as root, it switches to the system user given inuser=.
Configuration example
Content {
Name = "PG-PITR"
Include {
Plugin = "postgresql: pghost=/var/run/postgresql mode=pitr db=*"
}
}
Content {
Name = "PG-Dump-Remoto"
Include {
Plugin = "postgresql: mode=parallel_dump host=pg01.exemplo.local user=backup db=* parallel_dbs=4"
}
}
The first Content protects the local cluster with point-in-time recovery. The second produces parallel dumps of a remote server, with no agent on the database server.
| Backup option | Purpose |
|---|---|
mode | dump (default), parallel_dump, pitr, pitr_block or cdp. |
host, port, user | Connection to the server. |
database or db, exclude_db | Database selection. |
compress, compress_level | Compression, zstd by default, with level 3. |
verify | Backup verification, enabled by default. |
schema_include, schema_exclude, table_include, table_exclude | Selection by schema and by table. |
max_rate | Throughput limit. |
Performance: what to tune, and in what order
The performance of a database backup is set by the slowest point in a chain: reading the database, processing (compression and encryption), network and writing to the repository. The table maps the symptom to the most likely adjustment.
| Engine | Where the time goes | Adjustment |
|---|---|---|
| SQL Server | Reading the database in a single stream. | Increase stripes, and watch buffercount and maxtransfersize on the larger databases. |
| SQL Server | CPU of the database server. | Use native instead of native+zstd, or lower compress_level. |
| SQL Server | Many small databases, one at a time. | Increase parallel_dbs. |
| SQL Server | Impact on production at peak hours. | Limit with max_rate_kbps or move the window. |
| PostgreSQL | A very large table dominates the dump. | Adjust large_table_threshold and parallel_tables. |
| PostgreSQL | Many databases in sequence. | Increase parallel_dbs in parallel_dump. |
| PostgreSQL | Network between the database and the repository. | Use compression and, on large databases, pitr_block on PostgreSQL 17, which transfers only the changed blocks. |
| Both | Writing to the repository. | Check the sequential throughput of the Storage Daemon destination volume. |
How to measure
- Pick a representative database and run a full backup with the default configuration. Record the size, the duration and the effective throughput (size divided by duration).
- Change one variable at a time, repeating the backup, and record the result.
- Watch the server during the test: CPU, disk and network show where the limit is.
- Measure the restore too. The time that matters for the RTO is the time to get back, and it includes reapplying the logs.
The RPO sets the frequency of log backups: with an RPO of 15 minutes, they run every 15 minutes or less. The RTO adds up the restore time of the full, the differential and the logs up to the chosen point. These times depend on the infrastructure (network, database and repository storage, CPU), on compression and deduplication, and only the restore test shows the total for your environment.
The state of the art in database backup
Database engines have evolved in recent years, and backup practice has followed. The points below summarize what is worth considering when designing a policy.
Block-level incremental
PostgreSQL 17 introduced native incremental backup, SQL Server tracks changed pages for differentials and Oracle has changed block tracking in RMAN. On large databases, this is what keeps the window short.
Near-continuous logs
WAL archiving and log backups at short intervals bring the RPO down to minutes. The PostgreSQL cdp mode and SQL Server transaction logs fill that role.
Modern compression
Algorithms such as zstd offer a good compression ratio at a low CPU cost, and the gain varies with the type of data.
Encryption and immutability
Encrypting before the data leaves the server, with company-owned keys, and keeping a copy with locked retention in an S3 bucket with Object Lock protects against leaks and against ransomware.
Automatic verification
Backup checksum, RESTORE VERIFYONLY, DBCC CHECKDB, row count comparison and restore in a sandbox turn the assumption that the backup works into a measured result.
The 3-2-1-1-0 rule
Three copies, two media, one offsite, one immutable and zero errors on verification, which is the expected result of the restore test.
Recommended architecture

- Primary database and replica: the backup is read from the replica, and the primary keeps its production load free.
- NGBackup receives the fulls, the differentials and the logs, and the archived WAL in the case of PostgreSQL.
- A local repository for fast everyday restores, a copy at another site and an immutable copy in an S3 bucket with Object Lock.
- A scheduled restore test, on a lab server, with the database restored, checked and removed at the end, and the time recorded.
Replication, standby and continuous capture
For databases, replicating is not taking snapshots: it is continuously capturing the engine's transaction log and, when needed, building and maintaining a standby server. NGBackup sends the native logs of each engine (WAL, binlog, archived redo, oplog) to your storage over encrypted transport, with mutual TLS or a pre-shared key, and records everything in the same catalog as the backups.
- PostgreSQL: continuous WAL streaming (CDP), direct restore as a standby, logical replication capture and, from PostgreSQL 17, block-level incremental chains.
- SQL Server: log shipping, preparation of Always On Availability Groups and distribution of the same log backup to several destinations.
- Orchestration: a job builds the standby from the full and the log chain and keeps it up to date. Promotion is a single command, and the role swap between primary and standby is orchestrated by the plugin.
The recovery point (RPO) depends on the log capture interval, and the recovery time (RTO) depends on the standby already being built and on the infrastructure of the DR site. Replication complements backup: the standby delivers continuity, and the backup keeps the history, point-in-time recovery and the immutable copy. The details per engine are in the replication datasheet.
The family of database plugins
Besides SQL Server and PostgreSQL, NGBackup has native plugins for the main engines used in corporate environments.
| Plugin | How it protects |
|---|---|
| Oracle Database | Native backup through RMAN, with block-level incrementals, change tracking and point-in-time recovery. |
| MySQL, MariaDB and Percona | Dump and binary modes, consistent dump without locking InnoDB tables, single-table restore and point-in-time recovery. |
| MongoDB | Aware of replica sets and sharded clusters, with consistent snapshots. |
| Firebird | Backup with gbak, online or offline. |
| Informix | Online and offline backup, instance-aware. |
| ADABAS | Backup with ADASAV. |
| Progress and OpenEdge | Backup based on quiescing the database. |
| SAP HANA | Backint integration, in file mode or direct, with full, incremental and differential, and point-in-time recovery. |
Adoption checklist
| Question | Your environment's answer |
|---|---|
| What are the RPO and RTO of each database? | ______ |
Which backup mode meets that RPO (full and differential, with logs; pitr; cdp)? | ______ |
Is log archiving configured (archive_command on PostgreSQL, FULL recovery model on SQL Server)? | ______ |
| Does the backup account have the required permissions? | ______ |
| Is there temporary space for the largest database (Windows on SQL Server and the recovery area)? | ______ |
| Who runs the restore test, when, and where is the time record kept? | ______ |
| Where are the encryption keys kept, and is there a copy outside the backup server? | ______ |
| Is there an immutable, offsite copy? | ______ |
Frequently asked questions
Does the SQL Server plugin work on Linux and on Windows?
Yes. On Linux the backup uses a named pipe, and on Windows, a local temporary file that is streamed. On Linux, the plugin supports SQL Server 2017, 2019 and 2022.
Can I restore to another instance or under another name?
Yes. The instance= and database= options redirect the restore, and the new_db mode is the path for the restore test.
Does PostgreSQL need WAL archiving?
The pitr and pitr_block modes work with WAL and require archive_mode=on and an archive_command. The dump and parallel_dump modes do not depend on it and work as the first step.
Which mode should I choose?
For small databases and migrations, dump. For medium databases with a short window, parallel_dump. To recover to a point in time, pitr. For large databases on PostgreSQL 17, pitr_block. For an RPO of a few minutes, cdp together with one of the previous ones.
Can I try it at no cost?
Yes. The Community edition is free, and the free PoC is deployed by the NGBackup team in your environment.
Next step
In the free PoC, the NGBackup team installs the product in your environment, configures the database plugins for your instances and runs a complete backup and restore with the time measured, at no cost and with no commitment. The overview of the database plugins is on database backup, and the SQL Server and PostgreSQL pages have the details of each plugin.