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

Brazil Passes Landmark Law to Protect Children Online

https://www.hrw.org/news/2025/09/17/brazil-passes-landmark-law-to-protect-children-online
1•mooreds•1m ago•0 comments

GnuPG – post-quantum crypto landing in mainline

https://lists.gnupg.org/pipermail/gnupg-announce/2026q2/000504.html
1•zdkaster•2m ago•1 comments

Wedges and Control Points in Product Strategy

https://edwardhsu.substack.com/p/wedges-control-points-and-the-missing
1•rahimnathwani•10m ago•0 comments

Meetings Are Forcing Functions

https://www.mooreds.com/wordpress/archives/3734
1•zdw•15m ago•0 comments

The death of the American Dream is now official

https://thehill.com/opinion/finance/5846892-american-dream-debt-crisis/
7•Teever•16m ago•0 comments

Tell HN: Medvi (telehealth) hardcodes 999 patient emails in public JavaScript

1•g48ywsJk6w48•18m ago•0 comments

OWASP Top, Vibe Coding, and What Developers Miss with Tanya Janca [video]

https://www.youtube.com/watch?v=LSYkD-MKdmk
1•mooreds•20m ago•0 comments

How Meta used AI to map tribal knowledge in large-scale data pipelines

https://engineering.fb.com/2026/04/06/developer-tools/how-meta-used-ai-to-map-tribal-knowledge-in...
1•theorchid•21m ago•0 comments

Fruit Box

https://en.gamesaien.com/game/fruit_box/
2•downboots•23m ago•0 comments

Reviving Koken

https://www.bradleyboy.com/writings/reviving-koken/
1•bradleyboy•24m ago•0 comments

Discord Sleuths Gained Unauthorized Access to Anthropic's Mythos

https://www.wired.com/story/security-news-this-week-discord-sleuths-gained-unauthorized-access-to...
2•wyldfire•24m ago•0 comments

Starting with "Yes"

https://www.darthealth.com/blog/starting-with-yes
1•mooreds•25m ago•0 comments

The AI Compute Crunch Is Here (and It's Affecting the Economy)

https://www.404media.co/the-ai-compute-crunch-is-here-and-its-affecting-the-entire-economy/
2•gasull•31m ago•0 comments

Ukraine marks 40th anniversary of Chornobyl disaster under cloud of war

https://www.reuters.com/world/europe/ukraine-marks-40th-anniversary-chornobyl-disaster-under-clou...
3•onemoresoop•31m ago•0 comments

Harvard students call grading reform 'racist' in petition

https://www.campusreform.org/article/harvard-students-call-grading-reform-racist-petition/29761
3•ivewonyoung•38m ago•4 comments

LLMs Corrupt Your Documents When You Delegate

https://arxiv.org/abs/2604.15597
3•achrono•40m ago•1 comments

Reviving BrowserID in 2026

https://wakamoleguy.com/p/reviving-browserid-in-2026
1•wakamoleguy•48m ago•0 comments

Show HN: deterministic oracle for hardware designs with replayable proofs

https://suprastructure.net
1•suprastructure•50m ago•0 comments

Show HN: Draw Together Online

https://vidzert.com/draw-together
4•vidzert•51m ago•0 comments

Donald Trump is giving psychedelic medicines a welcome boost

https://www.economist.com/business/2026/04/23/donald-trump-is-giving-psychedelic-medicines-a-welc...
2•andsoitis•53m ago•0 comments

Claude Cowork Now Runs Any LLM. Test It Free

https://www.productcompass.pm/p/cowork-on-3p-any-llm
1•obilgic•55m ago•0 comments

Multi-Agent AI Systems Are Eating Single Agents

https://aistackinsights.ai/blog/multi-agent-ai-systems-langgraph-crewai-production-guide
2•aistackinsights•1h ago•0 comments

A Guide to CubeSat Mission and Bus Design

https://pressbooks-dev.oer.hawaii.edu/epet302/
2•o4c•1h ago•0 comments

I have officially retired from Emacs

https://nullprogram.com/blog/2026/04/26/
4•Fudgel•1h ago•0 comments

Reading Vault – free vocab tool that scores comprehension, not memory

https://www.readingvault.app
1•HimaghnaS•1h ago•0 comments

Modelling a Balanced Pencil(2014)

https://thatsmaths.com/2014/06/26/balancing-a-pencil/
1•o4c•1h ago•0 comments

Ask HN: What file sharing apps do you guys use?

3•samarthv•1h ago•3 comments

Can Frontier AI Labs make money?

https://janosmeny.com/blog/can-frontier-ai-labs-make-money/index.html
1•janos95•1h ago•0 comments

Trump evacuated from White House Correspondents' Dinner after shots fired

https://www.abc.net.au/news/2026-04-26/trump-evacuated-white-house-correspondents-dinner-shots-fi...
12•rport•1h ago•8 comments

Does Internet Advertising Work?

https://freakonomics.com/podcast/does-advertising-actually-work-part-2-digital-ep-441/
3•hackthemack•1h ago•3 comments