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?

Ask HN: What software has improved dramatically recently thanks to AI tooling?

1•pedrodelfino•18s ago•0 comments

The Death of the Downvote

https://nathankyoung.substack.com/p/the-death-of-the-downvote
1•bookofjoe•1m ago•0 comments

Hedystia – Next-Gen TypeScript Framework for Type-Safe APIs at Lightspeed

https://github.com/Hedystia/Framework
1•Zastinian•1m ago•1 comments

Proposal: Global Solar-Offset Fractional Time (G-Soft) Model

1•4TimeSake•2m ago•0 comments

Physical Laser Art

https://www.youtube.com/channel/UCJUV-vrFg0DI7nq-rbWkhGw
1•unit-vector•6m ago•0 comments

PlayStation gamers could receive £2B compensation if lawsuit succeeds

https://news.sky.com/story/playstation-gamers-could-receive-2bn-compensation-if-lawsuit-succeeds-...
3•Brajeshwar•8m ago•1 comments

EU Parliament: MEPs Vote to End Untargeted Mass Scanning of Private Chats

https://www.patrick-breyer.de/en/historic-chat-control-vote-in-the-eu-parliament-meps-vote-to-end...
2•anigbrowl•11m ago•1 comments

Shell declares force majeure to clients who buy Qatari LNG

https://www.reuters.com/business/energy/shell-totalenergies-others-declare-fm-their-clients-who-t...
1•geox•12m ago•0 comments

We built a lean, high-perf dashboard for Yeahchain

1•YeahchainTECH•13m ago•0 comments

Veil of Ignorance

https://en.wikipedia.org/wiki/Original_position
1•sillywabbit•13m ago•0 comments

New course on generative AI for behavioral science

https://statmodeling.stat.columbia.edu/2026/03/10/new-course-on-generative-ai-for-behavioral-scie...
1•dlojudice•17m ago•0 comments

Google sells partial stake in fiber, becomes minority owner of new venture

https://www.cnbc.com/2026/03/11/google-sells-partial-stake-in-fiber-becomes-minority-owner-in-ven...
3•internet-390•17m ago•0 comments

ICE/DHS gets hacked, all Contractors exposed

https://micahflee.github.io/ice-contracts/
2•peq42•22m ago•0 comments

Scaling the Lexinova Data Pipeline

1•LEXINOVAFaqs•24m ago•0 comments

Microsoft's growing control of Linux (2022)

https://lunduke.substack.com/p/microsofts-growing-control-of-linux
2•totetsu•25m ago•0 comments

Food costs set to spike as urea prices nearly doubles due to war in Iran

https://tradingeconomics.com/commodity/urea
35•burnt-resistor•25m ago•9 comments

Collecting perceptual data for a possible CSS optical-center property

1•gorkemyildiz•26m ago•0 comments

The Department of War is making a mistake [video]

https://www.youtube.com/watch?v=KBPOTklFTiU
1•ipnon•28m ago•0 comments

How do you handle state persistence in non-orientable data structures?

https://zenodo.org/records/18942850
1•MareSerenitatis•30m ago•1 comments

What happens if OpenAI or Anthropic fail?

https://www.reuters.com/commentary/breakingviews/what-happens-if-openai-or-anthropic-fail-2026-03...
6•billybuckwheat•31m ago•2 comments

Ask HN: Is Github Down Again?

https://twitter.com/m0nle0z/status/2031910716790517895
3•doanbactam•32m ago•4 comments

Why America Is Losing the War with Iran

https://chrishedges.substack.com/p/why-america-is-losing-the-war-with
6•chmaynard•32m ago•0 comments

I made a Chrome extension to export an entire Gemini chat

2•backrun•33m ago•0 comments

10 Years Later, I Reverse-Engineered iCloud's SyncToken by Brute Force

https://robhooper.xyz/blog-synctoken.html
2•rhoopr•34m ago•0 comments

Scalable quantum batteries can charge faster than their classical counterparts

https://phys.org/news/2026-03-scalable-quantum-batteries-faster-classical.html
1•Brajeshwar•35m ago•0 comments

Big Tech backs Anthropic in fight against Trump administration

https://www.bbc.com/news/articles/c4g7k7zdd0zo
4•jethronethro•36m ago•0 comments

Tunneling Nanotube

https://en.wikipedia.org/wiki/Tunneling_nanotube
1•rolph•38m ago•0 comments

The New York Times hated crossword puzzles before it embraced them

https://bigthink.com/pessimists-archive/new-york-times-hated-crossword-puzzles-wordle/
2•michaeld123•39m ago•1 comments

Live Coding with Caffeine

https://caffeine.js.org/talks/2018-08-25-demos-teaser/#/title
2•coliveira•39m ago•0 comments

I Don't Destroy Snowmen

https://writings.hongminhee.org/2026/01/ethics-of-small-actions/
4•foxfired•40m ago•2 comments