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?

Five Principles for Generating Readable AI Text in Bulk

https://fsdatalab.github.io/blog/agent-text-at-scale/
1•pretext•2m ago•0 comments

The Economics of Intelligence

https://institute.deepmind.com/essays/the-economics-of-intelligence/
1•pretext•4m ago•0 comments

Web Bot Auth: messh SDK 0.2.0 is out

https://messh.io
1•malviyamukul•5m ago•0 comments

Show HN: Catena – lazy sequences for Go where errors are elements

https://github.com/NerdMeNot/catena
1•srinivasiyer•5m ago•0 comments

Show HN: We mapped data center regulations across 50 states and 1,462 localities

https://regbase.com/datacenters
1•pensono•6m ago•0 comments

Show HN: Sheetgraph, AI agents can understand complex spreadsheets

https://github.com/asharma327/sheetgraph
1•asharma327•6m ago•0 comments

Show HN: System Design Articles from Companies

https://abhishekr3.github.io/rss-system-design/index.html
1•3Abhishek•7m ago•1 comments

An updated Model Spec for more capable and beneficial AI

https://openai.com/index/updated-model-spec/
1•pretext•9m ago•0 comments

We asked eleven AI models to chair the drafting of a multilateral statement

https://www.karlsnotes.com/we-asked-eleven-ai-models-to-chair-the-drafting-of-a-multilateral-stat...
2•valkrieco•9m ago•0 comments

Flexible wage deals can boost competitiveness, protect jobs, study says

https://www.reuters.com/business/world-at-work/flexible-wage-deals-can-boost-competitiveness-prot...
1•frank_clover•10m ago•0 comments

Alleged Chinese spy had 'close relationship' with Nvidia boss Jensen Huang

https://nypost.com/2026/10/29/business/alleged-chinese-spy-had-close-relationship-with-nvidia-bos...
5•mgh2•12m ago•0 comments

After 28 Years Walking Across the Globe, He's Almost Home

https://www.nytimes.com/2026/10/29/world/europe/karl-bushby-walking-globe-uk.html
1•rafaelc•13m ago•0 comments

Canada to invest up to $1.6B in Toronto-based AI company Cohere

https://www.cbc.ca/news/business/canada-cohere-ai-investment-9.7401367
3•barbazoo•15m ago•1 comments

Muscle Memory

https://my.clevelandclinic.org/health/articles/muscle-memory
1•jruohonen•15m ago•1 comments

Show HN: Pretty Git Tree – Your Git history as generative art

https://hmillerbakewell.github.io/pretty-git-tree/
2•hda-hda•17m ago•0 comments

Compose tasks, not implementations (2025)

https://thesephist.com/posts/task-composition/
1•mattvr•18m ago•0 comments

What America Is Living Without

https://www.nytimes.com/interactive/2026/10/28/opinion/american-dream-affordability.html
2•ParentiSoundSys•19m ago•0 comments

What's on That Access Port?

https://danielmangum.com/posts/whats-on-that-access-port/
1•hasheddan•20m ago•0 comments

Palantir shareholders want to know when they'll get their money back

https://www.ft.com/content/fbca8eb0-76ef-4e0e-bcc9-c45c8f7d1311
7•JumpCrisscross•21m ago•1 comments

Orbit.net Extra Packages for Nats.io

https://github.com/synadia-io/orbit.net
1•northlondoner•21m ago•1 comments

Shovel Brigade

https://www.shovel-brigade.cloud/
1•airhangerf15•22m ago•0 comments

Show HN: Playmat – Browser client for XMage, the open-source MTG engine

https://github.com/arcanite24/playmat
1•arcanite24•24m ago•0 comments

Thursday: A SerenityOS for Myself

https://shantaram.xyz/posts/2026/10/a-serenityos-for-myself
2•_shantaram•25m ago•0 comments

Rogue Constellation

https://rogueon.ai/blog/rogue-constellation
1•bananaflag•26m ago•0 comments

Fugazi

https://www.merriam-webster.com/slang/fugazi
1•gregsadetsky•26m ago•0 comments

Canada to join EU network of supercomputers

https://www.politico.eu/article/canada-joining-eu-supercomputer-network/
4•jruohonen•26m ago•1 comments

Show HN: Rankings of the state of the art, each figure sourced from the maker

https://tminuslabs.space/
1•tminuslabs•27m ago•0 comments

Renewables' Share of Electricity Is Rising While Nuclear Falling

https://ourworldindata.org/data-insights/the-world-is-getting-more-of-its-electricity-from-renewa...
2•karakoram•28m ago•0 comments

Show HN: Makr – find nearby co-founders

https://makr.breadbowl.ai/
1•mxudev•29m ago•0 comments

You Can Patch Everything [video]

https://www.youtube.com/watch?v=Hxqh2LS6vMs
1•karamazov•31m ago•0 comments