frontpage.
newsnewestaskshowjobs

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?

A New Framework for How the Brain Compresses Our Noisy World

https://www.quantamagazine.org/a-new-framework-for-how-the-brain-compresses-our-noisy-world-20260...
1•isaacfrond•1m ago•0 comments

Ask HN: Why do you use Ubuntu?

1•flanked-evergl•3m ago•0 comments

ByteDance Launches AI Office Product "Doubao Work"

https://www.ithome.com/0/993/865.htm
1•JulianVance•4m ago•1 comments

US removes Syria from terrorism sponsor list, lifting major investment obstacle

https://www.reuters.com/world/middle-east/us-removes-syrias-designation-state-sponsor-terrorism-2...
1•imadj•6m ago•0 comments

Effect v4 core package now has no external dependencies

https://twitter.com/tim_smart/status/2092430414837407896
1•tosh•6m ago•0 comments

Ask HN: What are you using to access x.com at the moment?

1•throwaw12•7m ago•0 comments

Bill Gates says world has "no plan" on AI in new essay

https://www.gatesnotes.com/a-turbulent-ai-era-and-critical-choices-to-make
2•aroman•9m ago•0 comments

S21

https://store.steampowered.com/app/4953120/S21/
2•ofrzeta•10m ago•1 comments

Dollywood

https://en.wikipedia.org/wiki/Dollywood
1•thunderbong•11m ago•0 comments

How to export Gemini chat to word without losing formatting [video]

https://www.youtube.com/watch?v=PZZGjJpPDM0
2•slimcrm•11m ago•1 comments

A joke for founders about the perfect startup geography [20 secs]

https://www.mangialardi.it/the-startup-paradox/
1•rm30•11m ago•1 comments

CSS Runtime Performance

https://nolanlawson.github.io/css-talk-2022/#1
1•luu•14m ago•0 comments

Show HN: Buslens – where can I get to by bus? (UK)

https://rupertlinacre.com/buslens/
1•RobinL•16m ago•0 comments

The Cowpox of Doubt (2014)

https://slatestarcodex.com/2014/04/15/the-cowpox-of-doubt/
1•pr337h4m•21m ago•0 comments

Disrupting a new covert influence campaign from Russia

https://openai.com/index/disrupting-malicious-uses-of-ai-influence-campaign-russia/
3•sam_lowry_•21m ago•0 comments

More than 100 suspicious images in Thermo Fisher antibody catalogue

https://www.nature.com/articles/d41586-026-01706-2
1•isaacfrond•23m ago•0 comments

Chinese regulators tell Tesla to fix nearly 3M cars

https://arstechnica.com/cars/2026/08/chinese-regulators-tell-tesla-to-fix-nearly-3-million-cars/
2•rbanffy•24m ago•1 comments

Global All Purpose Script

2•manesiro•25m ago•2 comments

World humanoid robot games show runners breaking records, bursting into flames

https://arstechnica.com/ai/2026/08/world-humanoid-robot-games-show-runners-breaking-records-burst...
2•robin_reala•33m ago•0 comments

NEET: Not in Education, Employment or Training. It's too late to fix this, but

https://www.virtueonline.org/post/neet-not-in-education-employment-or-trainingit-s-too-late-to-fi...
2•Michelangelo11•33m ago•0 comments

Show HN: Octomind Routines – scheduled agents on persistent cloud machines

https://octomind.run/blog/routines-scheduled-agents
1•donk8r•36m ago•0 comments

France, Saudi Arabia agree on €6B Dragon Ball Z theme park project near Paris

https://www.reuters.com/world/middle-east/france-saudi-arabia-agree-6-billion-dragon-ball-z-theme...
5•mmarian•36m ago•0 comments

Miroslav Tichý

https://en.wikipedia.org/wiki/Miroslav_Tich%C3%BD
2•Michelangelo11•40m ago•1 comments

Declinism

https://en.wikipedia.org/wiki/Declinism
3•soupspaces•41m ago•0 comments

A more nuanced view of LLMs

https://anarc.at/blog/2026-08-25-llm-nuance/
2•lumpa•43m ago•0 comments

Perplexity: A Local-First Agent for Private Knowledge Work

https://www.perplexity.ai/hub/blog/a-local-first-agent-for-private-and-cost-effective-knowledge-work
3•tosh•43m ago•0 comments

A Tour of Differentiable Rasterization

https://srush.github.io/DiffRast/
1•coffeeaddict1•46m ago•0 comments

Glyphcss › an ASCII render playground for 3D models (OBJ, glTF, STL, .vox)

https://glyphcss.com/gallery/
1•zakxxi•48m ago•0 comments

ArXiv: CTTE: An Open Dual-Protocol RISC-V Trace Encoder for N-Trace and E-Trace

https://arxiv.org/abs/2608.18170
1•xlbxrt•49m ago•0 comments

The tech community has lost an icon

https://twitter.com/RonConway/status/2092269443653181673
1•tosh•49m ago•0 comments