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•10mo 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•10mo 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•10mo 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•10mo 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•10mo ago
Load test against a clone instead of a DB whose contents you care about?

Gary Kildall, Bill Gates and the "Gentleman's Agreement"

https://nemanjatrifunovic.substack.com/p/gary-kildall-bill-gates-and-the-gentlemans
1•whobre•46s ago•0 comments

GDL: Grep-native data language for agentic systems

https://github.com/greppable/spec
1•handfuloflight•1m ago•0 comments

Ardent

https://tryardent.com/
1•handfuloflight•2m ago•0 comments

The grep-native language for agentic systems

https://greppable.ai/
2•mercat•3m ago•0 comments

Genetic factors drive the link between cognitive ability,socioeconomic status

https://www.psypost.org/genetic-factors-drive-the-link-between-cognitive-ability-and-socioeconomi...
1•myth_drannon•3m ago•0 comments

Nostr Wallet Connect (NWC) is an open protocol to connect wallets to apps

https://nwc.dev/
1•janandonly•4m ago•0 comments

AI spurring expansion of high-voltage lines. Landowners, locals fighting back

https://apnews.com/article/ai-trump-energy-transmission-lines-f1c6b1251054d2a7e193297e4111b8d1
1•1vuio0pswjnm7•6m ago•0 comments

Morse code converter CLI tool written in Rust

https://github.com/zsphinxyz/zmorse-cli
1•zsphinx•6m ago•0 comments

Beating App Store review: lessons from shipping a minimal indie game

https://blog.kulman.sk/beating-app-store-review/
1•ig0r0•7m ago•0 comments

How to Create a WSL2 Ubuntu Full Desktop Environment

https://github.com/1ch4k/WSL2-Ubuntu-GUI-XRDP
1•1ch4k•8m ago•0 comments

I built a Chrome extension that syncs your life with your menstrual cycle

https://chromewebstore.google.com/detail/cyclesync/egmjjdfhnnbkloiijjehpkjgfeghifeb
1•Ogbon•9m ago•1 comments

Researchers Gave AI Agents Real Tools. One Deleted Its Own Mail Server

https://medium.com/@tbelbek/38-researchers-gave-ai-agents-real-tools-one-deleted-its-own-mail-ser...
1•rdstrtwlkr•10m ago•0 comments

What Has Gone Wrong with Fiction in Our Era?

https://samkahn.substack.com/p/what-has-gone-wrong-with-fiction
1•jger15•10m ago•0 comments

LLMs Aren't AGI – and They Never Will Be

https://lovelaceanalytics.com/posts/never-be-generalised-ai/
1•gabemusker•11m ago•0 comments

YouTube surpasses Disney, Paramount, WBD in 2025 ad revenue

https://techcrunch.com/2026/03/10/youtube-surpasses-disney-paramount-wbd-in-2025-ad-revenue/
1•thunderbong•11m ago•0 comments

M2x2

https://www.wattiv.nl/work/m2x2/
1•fredley•12m ago•0 comments

Trump: Iran Has Tomahawk Missiles

https://xcancel.com/realstewpeters/status/2031142386483474465?s=20
2•doener•12m ago•0 comments

Behind the Curtain: America's big lie

https://www.axios.com/2026/03/11/america-social-media-polarization
1•1vuio0pswjnm7•13m ago•0 comments

Yann LeCun's AMI Labs raises $1.03B to build world models

https://techcrunch.com/2026/03/09/yann-lecuns-ami-labs-raises-1-03-billion-to-build-world-models/
1•sylvainkalache•14m ago•0 comments

Understanding Container Images: Layers, Configs, Manifests, and More

https://labs.iximiuz.com/tutorials/container-image-from-scratch
1•birdculture•15m ago•0 comments

Manipulating AI memory for profit: The rise of AI Recommendation Poisoning

https://www.microsoft.com/en-us/security/blog/2026/02/10/ai-recommendation-poisoning/
2•doener•18m ago•1 comments

European Space Agency, China achieve gigabit links to geostationary satellites

https://www.theregister.com/2026/03/04/gigabit_laser_links_geostationary_satellites/
1•pseudolus•19m ago•0 comments

Just Use Postgres

https://nesbitt.io/2026/03/10/just-use-postgres.html
2•watchful_moose•19m ago•0 comments

Ask HN: Agencies/MSPs, how do you manage VPN access across many clients?

2•k4roshi•19m ago•0 comments

Why I (Still) Use Aider in 2026

https://semyonsinchenko.github.io/ssinchenko/post/aider_2026_and_other_topics/
1•s-sem•20m ago•0 comments

Why should operating systems and websites track the user age?

https://wiki.alcidesfonseca.com/blog/age-verification-in-operating-systems-and-the-internet/
1•alcidesfonseca•21m ago•0 comments

Scientists discover how falling cats almost always make perfect landings

https://phys.org/news/2026-03-japanese-scientists-falling-cats.html
1•pseudolus•22m ago•0 comments

Hacker Infrastructure

1•yjtpesesu2•23m ago•1 comments

Show HN: Aver – a language designed for AI to write and humans to review

https://github.com/jasisz/aver
1•jasisz•23m ago•1 comments

Getweeks: A life calendar that connects your goals to weekly lifestyle changes

https://www.getweeks.com/fr
1•benlatger•26m ago•1 comments