frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Ask HN: How can I load test PostgreSQL but avoid changing actual data?

1•LawZiL•1y ago
I'm running a load test on my Node.js application and want to simulate realistic write-heavy scenarios to stress test the system — especially the PostgreSQL database.

There's a part of the code that performs UPDATE queries, but during load testing, I don't want these updates to actually change the state of the database. However, I still want the database to experience the full impact of the update — query planning, locking, I/O, WAL writes, etc. — so I can measure how it affects performance under peak load.

Is there a best-practice approach to achieve this?

So far, the most viable option I’ve found is to wrap the UPDATE queries in a transaction and then roll it back — that way, the queries still execute, but the state doesn’t change. Is this the right way to go? Does rollback introduce any performance overhead that would skew my results? Are there better or more realistic alternatives that simulate the full write path without persisting changes?

Thanks in advance!

Comments

sargstuff•1y ago
pgbench[2] / pgreplay-go[0] / python locust[1]

very old school approach:

Misuse sql VIEW[3][4] to generate a temporary parallel table setup. Testing database separate from production database would be 'better', IMHO.

-----

[0] pgreplay-go : https://github.com/gocardless/pgreplay-go

[1] python locust : https://miguel-codes.medium.com/unconventional-load-testing-...

[2] pgbench load testing :

   a) https://medium.com/@c.ucanefe/pgbench-load-test-166bdfb5c75a

   b) https://neon.tech/blog/autoscaling-in-action-postgres-load-testing-with-pgbench

   c) https://hackernoon.com/how-to-create-and-load-test-data-in-postgresql-i41e353m
----------------------------

[3] : a) https://hashrocket.com/blog/posts/materialized-view-strategi...

      b) https://tech.jonathangardner.net/wiki/PostgreSQL/Materialized_Views

      c) https://stackoverflow.com/questions/77603705/what-is-the-use-of-materialized-view-in-postgresql
[4] : https://en.wikipedia.org/wiki/View_(SQL)
LawZiL•1y ago
but again, how can i perform the query, but not actually change the state, i really need the state to keep untouched, but be able to perform the query itself.
MatthiasPortzel•1y ago
> Does rollback introduce any performance overhead that would skew my results?

I would expect it to be the other way around—since the transactions are rolled back and not committed, they would have significantly less performance impact. But I’m working from an academic model of the database.

apothegm•1y ago
Load test against a clone instead of a DB whose contents you care about?

The tech industry as a grass fire

https://nathanschneider.info/2026/05/the-tech-industry-as-a-grass-fire/
1•ntnsndr•2m ago•0 comments

Agentic AI token usage balloons cost at Microsoft, Meta, Amazon

https://www.tomshardware.com/tech-industry/artificial-intelligence/ai-cost-crisis-hits-tech-giant...
1•heresie-dabord•3m ago•0 comments

Lambda Soup – Functional HTML Scraping for OCaml

https://aantron.github.io/lambdasoup/
1•Tomte•4m ago•0 comments

Gradient Google icon redesign rolling out on Android and web

https://9to5google.com/2026/05/22/gradient-google-icon-redesign-web/
1•theanonymousone•5m ago•0 comments

Hardening against future module security issues with ModuleJail

https://linuxsecurity.com/features/linux-kernel-module-hardening-modulejail
1•thefreelantern•6m ago•0 comments

A World Without Apps

https://www.bigideainitiative.org/ideas/a-world-without-apps
1•sim04ful•6m ago•0 comments

Meditations in Color

https://meditationsincolor.com/colorists
1•pixelsymphony•7m ago•1 comments

New Attack "Megaladon" Compromises 5.5K+ GitHub Repos

https://www.theregister.com/security/2026/05/22/megalodon-chums-the-waters-in-55k-github-repo-poi...
1•theanonymousone•9m ago•0 comments

Polsia Raises $30M as Its AI Autonomously Runs 7,600 Businesses

https://noqta.tn/en/news/polsia-ai-autonomous-company-30m-funding-2026
1•Topology1•10m ago•0 comments

Kysely (the type-safe SQL query builder for TypeScript) v0.29 is out btw

https://github.com/kysely-org/kysely/releases/tag/v0.29.0
1•igalklebanov•11m ago•1 comments

Lisp in Vim (2019)

https://susam.net/lisp-in-vim.html
2•whent•11m ago•0 comments

Meta Settles School Suit over Social Media, Averting Trial

https://www.bloomberg.com/news/articles/2026-05-21/meta-settles-school-suit-over-social-media-ave...
1•1vuio0pswjnm7•15m ago•0 comments

A simple and free Markdown editor

https://marina-md.pages.dev/
1•alllen•15m ago•0 comments

CloudNativePG and Crunchy PGO: an honest, opinionated comparison

https://www.gabrielebartolini.it/articles/2026/05/cloudnativepg-and-crunchy-pgo-an-honest-opinion...
1•bo0tzz•16m ago•0 comments

I poisoned a Hugging Face dataset and it stayed up for 6 months

https://vechron.com/2026/05/i-poisoned-a-hugging-face-dataset-and-it-stayed-up-for-6-months/
2•GeorgeWoff25•19m ago•2 comments

AlphaProof Nexus solves 9 Erdős problems and proves 44 sequence conjectures

https://cryptobriefing.com/deepmind-alphaproof-nexus-erdos-problems/
2•hackernj•20m ago•1 comments

AI companies use malware proxies to mount DDoS attacks on web sites

https://packetstream.io/scraping-at-scale-without-breaking-the-bank-a-guide-for-ai-startups/
2•fanf2•24m ago•0 comments

Ask HN: Do you have a colophon for your personal website?

3•susam•25m ago•2 comments

Tell HN: Google slightly changed its wordmark logo

2•exploraz•26m ago•0 comments

Stephen Colbert represented the worst of establishment liberalism

https://unherd.com/newsroom/stephen-colbert-represented-the-worst-of-establishment-liberalism/
6•sameers•27m ago•2 comments

The Primordial Credit Argument for Unconditional Basic Income (UBI)

https://scottsantens.substack.com/p/the-primordial-credit-argument-for
2•2noame•29m ago•0 comments

Kolhaam-Network: an unmoderated encrypted chat network in the BBS tradition

https://github.com/ronen-blumberg/kolhaam-network
1•stigma77•30m ago•0 comments

(An Opinionated) Site Colophon (2023)

https://brett.coulstock.id.au/site-colophon.html
1•Tomte•32m ago•0 comments

Luddite Lab Resource Hub

https://labor.dair-institute.org/
1•jkestner•37m ago•0 comments

I built an MCP server so you can ask Claude about your cloud/software bill

https://getnable.com/
1•chaandannn•38m ago•0 comments

Apple says Epic lawsuit shouldn't reshape App Store rules for all developers

https://techcrunch.com/2026/05/22/apple-says-epic-lawsuit-shouldnt-reshape-app-store-rules-for-al...
4•rebekkamikkoa•38m ago•1 comments

Google Acquires Zagat (2011)

https://googleblog.blogspot.com/2011/09/google-just-got-zagat-rated.html
1•azinman2•39m ago•0 comments

Steam Deck Software in 2026:Checking in with the Developers Behind the Ecosystem

https://gardinerbryant.com/steam-deck-software-in-2026/
2•ZeroCool2u•39m ago•0 comments

z386: An Open-Source 80386 Built Around Original Microcode

https://nand2mario.github.io/posts/2026/z386/
5•wicket•41m ago•0 comments

It took 2 years for GNOME Commander to migrate to Rust from C++

https://www.phoronix.com/news/GNOME-Commander-2.0
2•egorfine•42m ago•0 comments