Postgres is half as fast in Linux 7.0, and we always knew why

· Source: Hussein Nasser · Field: Technology & Digital — Software Development & Engineering, Cloud Computing & IT Infrastructure · Depth: Expert, extended

Summary

An Amazon engineer, U Salvatore from Amazon Italia, discovered a significant 50% performance regression in Postgres 18 when tested with the upcoming Linux kernel 7.0, specifically on April 3rd, 2026. This slowdown stems from Linux 7.0's new default "preempt lazy" kernel preemption mode, which allows kernel code to be preempted more readily than the previous "preempt none" default. Postgres's process-based architecture, which relies on spin locks to protect shared buffers, experiences a high volume of page faults due to lazy page table population for each connection. Under "preempt lazy", a process holding a spin lock can be preempted during a page fault, leaving other processes to spin-wait, drastically reducing throughput. A configuration workaround involves enabling Huge Pages (2MB instead of 4KB) to reduce the frequency of page faults, effectively resolving the immediate performance drop. The underlying issue highlights Postgres's process-based design versus a thread-based approach.

Key takeaway

For DevOps Engineers or Database Administrators deploying Postgres on Linux kernel 7.0, you must enable Huge Pages to prevent a 50% performance regression. The new "preempt lazy" kernel default, combined with Postgres's process-based architecture, causes severe spin lock contention during page faults. Configuring Huge Pages (2MB) is a critical workaround to maintain expected throughput. You should also consider the long-term implications of process-based database designs on modern kernel behaviors.

Key insights

Linux kernel's "preempt lazy" default exposed Postgres's process-based architecture vulnerability to page fault-induced spin lock contention.

Principles

Method

Troubleshooting involved recompiling the kernel commit-by-commit to isolate the regression's source.

In practice

Topics

Best for: CTO, VP of Engineering/Data, Software Engineer, Data Engineer, DevOps Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Hussein Nasser.