Skip to content

Postgres Performance

Matt Welch edited this page Nov 11, 2025 · 1 revision

PostgreSQL is a powerful, open-source object-relational database system that extends the SQL language with advanced features designed to handle complex data workloads safely and efficiently. Among its robust toolset, PostgreSQL includes pg_dump, a utility for backing up databases. pg_dump is a postgres utility for backing up databases. It supports several compression methods comprising gzip, lz4, and zstd which makes it a useful tool to benchmark compression performance.

zlib-accel, enables hardware-accelerated compression in PostgreSQL without requiring any code changes. To use it, simply preload the zlib-accel library and choose zlib as the compression method. For more details on Intel IAA and QAT hardware accelerators, please refer to the README.

zlib-accel was benchmarked against gzip, which uses the zlib library for compression, zlib-ng, an enhanced variant of zlib, and zstd, a widely-used high-performance software compression library. The measurement process begins by populating a database with sysbench. This database creation is done once for the five compression methods described to ensure they are working from the same starting point. The pg_dump utility is then used to back up the database using the selected compression method, while the duration of the backup process is recorded. In complement to the pg_dump utility, PostgreSQL also includes the pg_restore utility which can be used to decompress archives created with pg_dump. While pg_restore is a normal part of the backup-restore workflow, the time spent in decompression has little impact on the overall performance.

Configuration

System/Software

  • AWS EC2 instance: i7i.metal-24xl
  • Storage (DB and backup): 6 x direct-attached 3.4 TB NVMe, striped in a 20.4 TB RAID0 disk array
  • OS: Ubuntu 24.04.3, kernel 6.8.0
  • PostgreSQL v17.4

Compression libraries/compression levels

  • zlib v1.3 (level: 6)
  • zlib-ng v2.2.4 (level: 6)
  • zstd v1.5.7 (level: 6)
  • QATzip v1.3.0 (for QAT acceleration, level: 9)
  • QPL v1.7.0 (for IAA acceleration, level: 1)

zlib-accel Configuration

zlib-accel v1.0.0 built with logging disabled and Release build type

cmake -DUSE_IAA=ON -DQPL_PATH=<path> -DUSE_QAT=ON -DDEBUG_LOG=OFF -DCMAKE_BUILD_TYPE=Release ..

zlib-accel configuration for QAT runs

use_qat_compress = 1
use_qat_uncompress = 1
use_iaa_compress = 0
use_iaa_uncompress = 0
use_zlib_compress = 1
use_zlib_uncompress = 1
iaa_prepend_empty_block = 0
qat_periodical_polling = 0
qat_compression_level = 9

zlib-accel configuration for IAA runs

use_qat_compress = 0
use_qat_uncompress = 0
use_iaa_compress = 1
use_iaa_uncompress = 1
use_zlib_compress = 1
use_zlib_uncompress = 1
iaa_prepend_empty_block = 0
qat_periodical_polling = 0
qat_compression_level = 1

sysbench Configuration

sysbench configuration

  • Tables: 400
  • Rows: 1,000,000
  • Population script: oltp_read_only.lua

To select zlib/zstd compression

pg_dump --compress=gzip <other_options>
pg_dump --compress=zstd <other_options>

To run with zlib-ng, preload the zlib-ng library and select zlib compression

LD_PRELOAD=<zlib-ng path>
pg_dump --compress=gzip <other_options>
unset LD_PRELOAD

To run with zlib-accel, preload the zlib-accel library and select zlib compression

LD_PRELOAD=<zlib-accel path>
pg_dump --compress=gzip <other_options>
unset LD_PRELOAD

Results

The plot below shows PostgreSQL backup throughput (kB/s) with various compression algorithms comprising gzip, zstd and zlib-ng for software compression, IAA and QAT for hardware-accelerated compression. The x-axis represents increasing job counts from 4 to 64 concurrent backup processes. For each algorithm, the performance is normalized to the throughput of gzip for that job count.

image

Using the same data from the previous figure, the next plot highlights the PostgreSQL backup throughput (kB/s) at 4 jobs for the same compression algorithms compared above. As before, each algorithm's performance is normalized to the throughput of gzip. Additionally, the compression ratio (backup size / original size) relative to gzip is plotted as a red trendline on the secondary axis.

image

Compared to zlib (deflate compression)

  • QAT provides up to 29.3x throughput gain, with a compressed data size tradeoff of 2.8%
  • IAA provided up to 23.4x throughput gain, with a compressed data size tradeoff of 5.4%

Compared to zlib-ng (faster option for software deflate)

  • QAT provides up to 7.6x throughput gain, with a compressed data size tradeoff of 3.1%
  • IAA provides up to 6.1x throughput gain, with a compressed data size tradeoff of 5.7%

zstd is one of the newer algorithms having both good compression ratio and speed. Based on our results, zstd is the fastest among the software-only compression algorithms which makes it a compelling option. Also for the 4-job case, the following data normalizes the performance of each algorithm, to that of zstd.

Compared to zstd:

  • QAT provides up to 4.9x throughput gain, with no tradeoff in compressed data size
  • IAA provides up to 3.9x throughput gain, with a compressed data size tradeoff of 2.1%

Testing performed by Intel in October 2025

Notices & Disclaimers

Performance varies by use, configuration and other factors. Learn more on the Performance Index site.

Performance results are based on testing as of dates shown in configurations and may not reflect all publicly available updates. See backup for configuration details. No product or component can be absolutely secure.

Your costs and results may vary.

Intel technologies may require enabled hardware, software or service activation.

© Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries. Other names and brands may be claimed as the property of others.

Clone this wiki locally