Navigate Select ESC Close

Making Postgres 42,000x slower

2025-08-04 Science & Technology
161.6k
4.0k
151
ThePrimeTime
ThePrimeTime
1.1m subscribers

Making PostgreSQL 42,000 Times Slower Via Configuration Tuning

Discover the exact configuration parameters required to take a highly optimized PostgreSQL instance and reduce its transaction throughput by over 42,000 times, demonstrating granular control over database I/O and background processes.

Short Summary

  • Dropped baseline transaction throughput (7,082 TPS) to under 0.1 TPS by exclusively modifying PostgreSQL configuration settings.
  • Caching strategy was destroyed by shrinking shared buffers from 10GB to 2MB, forcing heavy disk reads.
  • Background maintenance tasks (autovacuum and WAL checkpoints) were hyper-aggressive, forcing excessive I/O interruptions.
  • Index usage was systematically disabled by manipulating query planner heuristics regarding random access costs.

This session reviews a challenge where the goal was achieving maximum database latency by only editing parameters in the postgresql.conf file. The speaker details the step-by-step configuration changes targeting caching, vacuuming, Write-Ahead Logging (WAL), and query planning costs, resulting in a nearly unserviceable database environment in controlled testing.

Unlock all features

FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.

Description

https://twitch.tv/ThePrimeagen - I Stream 5 days a Week https://twitter.com/terminaldotshop - Want to order coffee over SSH? ssh terminal.shop ### LINKS -- https://byteofdev.com/posts/making-postgres-slow/ By: Jacob Jackson Become Backend Dev: https://boot.dev/prime (plus i make courses for them) This is also the best way to support me is to support yourself becoming a better backend engineer. Great News? Want me to research and create video????: https://www.reddit.com/r/ThePrimeagen Kinesis Advantage 360: https://bit.ly/Prime-Kinesis

Top Comments (10)

@LevantinLynx 2025-08-04

Fun fact: The article is a better documentation of the config file than the Postgres default docu…

1.2k 8 replies
@rumplstiltztinkerstein 2025-08-04

How to be successful. When creating a database, set these as the initial configurations. Then, after it is deployed, say you are going to "optimize" it, remove the configurations, add to your resume how you made the database 42000x faster. Get a promotion, etc.

763 6 replies
@jonathanmarino7968 2025-08-04

This guy knows where the performance is, by knowing where it isn't

293 3 replies
@kamil118 2025-08-05

Finally, 0.00002x engineer

216
@oussama7132 2025-08-04

this is more advanced than putting random sleep command in the codebase, I'll be using this to proclaim that I improved the performance to my boss!

182 1 replies
@NotAFanMan88 2025-08-04

Good article. Now I can make sure to use all these tips and tricks at work to make things worse for everyone.

89
@vsolyomi 2025-08-04

This should absolutely be an esport!

56
@GordoProgramacion 2025-08-04

yes, finally! I'm tired of everyone trying to help me optimize my pgdb and no one helping me enshitify it

48
@abixx69 2025-08-04

Postgres's got to be one of the most fascinating technologies developed in this century. It is a masterpiece in modern engineering

34
@Chrisxantixemox 2025-08-04

Honestly, this is a really really good way to learn something.

18

Unlock the Data Inside
Turn Videos into Knowledge

  • Get FREE 10/day: transcripts, summaries, chats
  • Chat with videos, export text & PDF
  • $1 free API credit for RAG, chatbots & research

Free forever plan • All features unlocked

App screenshot