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?

Helium balloon lifts up two tons of building material over Tibet's mountains

https://www.thedailybeast.com/trump-humiliated-as-un-speech-bombs-with-bored-audience/
1•ksec•10m ago•1 comments

Big Banks Say They're Uneasy About People Shopping via AI Agents

https://gizmodo.com/big-banks-say-theyre-uneasy-about-people-shopping-via-ai-agents-2000815443
1•thm•11m ago•1 comments

LGBT tolerance slumps in the Netherlands as debate turns vicious

https://www.dutchnews.nl/2026/09/lgbt-tolerance-slumps-in-the-netherlands-as-debate-turns-vicious/
3•latexr•18m ago•0 comments

Show HN: Kern.md – Single-session long-running agent

https://github.com/oguzbilgic/kern-ai/blob/master/templates/KERN.md
1•obilgic•22m ago•0 comments

Anthropic classifiers prohibit kernel development

https://twitter.com/TheAhmadOsman/status/2102535871727857915/photo/1
4•nullbio•23m ago•1 comments

United Nations: AI Agents, Misalignment and the Risk of Losing Human Control [pdf]

https://www.un.org/independent-international-scientific-panel-ai/sites/default/files/2026-09/Them...
1•nsagent•24m ago•0 comments

Grammarly will send unhinged messages to all your users if you try to cancel

https://www.reddit.com/r/sysadmin/comments/1wjdpgx/psa_grammarly_will_send_unhinged_messages_to_all/
3•ksec•24m ago•1 comments

Acer CEO says memory makers are hyping 2030 shortage fears to protect margins

https://www.tomshardware.com/pc-components/dram/acer-ceo-says-memory-makers-are-hyping-2030-short...
4•alok-g•24m ago•1 comments

North Texas engineer built a map for cheap local restaurants [video]

https://www.youtube.com/watch?v=K6qhp0SsEcM
2•phodo•25m ago•1 comments

Data-Only Attacks Are Easier Than You Think

https://www.usenix.org/publications/loginonline/data-only-attacks-are-easier-you-think
4•segfaultbuserr•35m ago•0 comments

A Machine Beat Me at Chess. I'm Still Rooting for AI

https://www.thenextmove.org/p/a-machine-beat-me-at-chess-im-still
1•akbarnama•38m ago•0 comments

Loment: A self-hosted systems language with multi-syntax front ends

https://github.com/FujoJTOP/loment
1•FujoLoment•40m ago•1 comments

Porting Bhyve to Rust

https://github.com/TritonDataCenter/rshyve
2•nwilkens•45m ago•1 comments

Snorkel AI triples valuation to $3.5B as demand for AI training data booms

https://techcrunch.com/2026/09/22/snorkel-ai-triples-valuation-to-3-5b-as-demand-for-ai-training-...
2•nlpnerd•46m ago•2 comments

Anatomy of a (Postgres) Search Engine

https://planetscale.com/blog/anatomy-of-a-postgres-search-engine
1•ksec•51m ago•0 comments

Specs cut defects in AI-generated code from 148 to 23 across five models

https://arxiv.org/abs/2609.23270
1•sandeepdhuri•51m ago•0 comments

President Lula Dataset

https://huggingface.co/datasets/geoffchan/lula-footage/viewer/default/train
1•rodrigueslotu•52m ago•0 comments

RGPU – Use a remote Nvidia GPU from PyTorch on a machine that has none

https://rgpu.dev
1•boxstream•58m ago•0 comments

Americans Are About to Lose Access to Prescriptions from Canada

https://www.wsj.com/health/healthcare/us-customs-prescription-drugs-canada-71978a47
5•baran•58m ago•0 comments

Critical Period in Brain Development

https://www.simplypsychology.org/critical-period.html
4•kamaraju•58m ago•0 comments

HarmBlock+ Safest Smartphone: Please Rotate Responsibly

https://paul.reviews/harmblock-worlds-safest-smartphone-please-rotate-responsibly/
1•pseudohadamard•1h ago•0 comments

Sadness and Suicidal Behavior Among Teenagers Is Declining, CDC Finds

https://www.nytimes.com/2026/09/21/science/teen-sadness-depression.html
2•lxm•1h ago•0 comments

Agent-browser equivalent for desktop and mobile apps

https://agent-device.dev
1•novoreorx•1h ago•0 comments

Emergent Collusion in Long-Horizon LLM Agent Interaction

https://arxiv.org/abs/2609.24967
1•sbulaev•1h ago•0 comments

Show HN: SubRead: line up an audiobook with its eBook, in the browser

https://subread.space
1•equwal•1h ago•0 comments

Ask HN: Is anyone charging extra their customers for credit card payments?

1•thomasjeff1•1h ago•2 comments

Show HN: Sbm: plain-text bookmarks synced across terminal, browser, Android

https://sbmsync.com
2•equwal•1h ago•0 comments

Transit rewards (Waymo pays you to take the train)

https://waymo.com/blog/2026/09/transit-rewards/
24•raybb•1h ago•8 comments

AgeKey – Privacy First Age Verification

https://agekey.org/how-age-signals-work
1•pickledish•1h ago•0 comments

How to Create Your Own Personal AI Benchmark

https://every.to/also-true-for-humans/how-to-create-your-own-personal-ai-benchmark
2•Garbage•1h ago•0 comments