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?

Hex1bThe .NET Terminal Application Stack

https://hex1b.dev/
1•joshka•40s ago•0 comments

What If Everyone Saw Your Whole Digital Life?

https://nymag.com/intelligencer/article/your-digital-self-is-vulnerable.html
1•gaws•59s ago•0 comments

Ask HN: Would you want to know when and how you die?

1•JohnDSDev•2m ago•0 comments

The Technical Realities of Email Privacy

https://www.ivpn.net/privacy-guides/email-and-privacy/
3•jethronethro•3m ago•0 comments

Something Is Very Wrong in San Francisco

https://www.simplermachines.com/something-is-very-wrong-in-san-francisco/
1•danorama•3m ago•0 comments

Hubble tension, dark energy, and α from one number, zero free parameters

https://zenodo.org/records/19230547
1•yukky•6m ago•0 comments

All Gists Discussed on HN

https://news.ycombinator.com/from?site=gist.github.com&kind=comment
1•sillysaurusx•6m ago•1 comments

Discussion of GitHub repos on HN

https://news.ycombinator.com/from?site=github.com&kind=comment
1•sillysaurusx•7m ago•0 comments

"polarization" might, in part, be a proximity issue

https://justinjackson.ca/communication
2•YounesDz•8m ago•1 comments

France to ditch Palantir's AI data tools in favour of domestic provider

https://www.theguardian.com/world/2026/jun/16/france-ai-data-tools-palantir-chapsvision
6•devonnull•11m ago•0 comments

Property Graph Support in PostgreSQL 19

https://www.postgresql.org/docs/19/ddl-property-graphs.html
1•tharakam•11m ago•0 comments

How to Deploy Hermes AI Agent with Docker and HTTPS

https://devopness.com/blog/deploy-hermes-ai-agent-devopness/
1•Diegiwg•12m ago•0 comments

US moves to offer Iran sanctions relief

https://www.timesofisrael.com/liveblog_entry/us-to-allow-iran-to-begin-selling-oil-and-fuel-immed...
1•GreenSalem•13m ago•0 comments

Skill Fablize for Hermes

https://github.com/teixeirazeus/fablize-for-hermes
1•teixeirazeus•13m ago•0 comments

OBS Agentic Control Interface

https://github.com/DeepBlueDynamics/obsagent
1•kordlessagain•18m ago•0 comments

Trump admin tries to block Clean Air Act lawsuit over xAI's gas turbines

https://arstechnica.com/tech-policy/2026/06/trump-admin-helps-xai-fight-pollution-lawsuit-says-mi...
5•staplung•25m ago•1 comments

The Limits of Altruism

https://asindu.xyz/blog/the-limits-of-altruism/
1•asxndu•25m ago•0 comments

Web Search API for Agents 70x Cheaper Than Exa

https://www.searchspace.io/
2•carsonpoole•27m ago•0 comments

OpenAI spending hit $34B last year ahead of planned IPO, $21B losses

https://www.ft.com/content/e15b0d7e-ff6b-4f16-ba7a-4068feddb828
2•1vuio0pswjnm7•27m ago•0 comments

Building Production AI Apps on Claude Code and Cloudflare [video]

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

How HN: Nova BRAIN – STIG scanning and POA&M automation dashboard

https://dawitone.gumroad.com/l/fgwfzl
1•Butulove•30m ago•0 comments

GoJS – Interactive diagramming for every industry

https://gojs.net/latest/
1•simonsarris•30m ago•0 comments

How to make small models punch way above their weight with DeepClause

https://deepclause.substack.com/p/how-to-make-small-models-punch-way
1•schmuhblaster•31m ago•0 comments

Gravitational-wave detections double with new catalog

https://news.northwestern.edu/stories/2026/03/gravitational-wave-detections-double-with-new-catalog
1•wglb•31m ago•0 comments

Framer 3.0

https://www.framer.com/updates/framer-3
1•SpyCoder77•32m ago•0 comments

OpenAI's financials have leaked, showing $21B in losses against $13B in revenue

https://fortune.com/2026/06/16/openai-financials-leaked-losses-revenue-profit/
6•1vuio0pswjnm7•32m ago•1 comments

Spin separates giant planets from 'failed stars'

https://news.northwestern.edu/stories/2026/03/spin-separates-giant-planets-from-failed-stars
2•wglb•33m ago•0 comments

Show HN: I Built a Free Text Based Audio Editor

https://audioeditor.pro/
1•wbemaker•34m ago•0 comments

How SpaceX's arrival impacts the stock market

https://www.axios.com/2026/06/15/spacex-ipo-stock-retail
1•1vuio0pswjnm7•34m ago•0 comments

PP-OCRv6

https://huggingface.co/collections/PaddlePaddle/pp-ocrv6
3•gomizhuce•37m ago•0 comments