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•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?

Why Are Human Teeth So Messed Up? (2017)

https://www.sapiens.org/biology/human-teeth-evolution/
2•downbad_•2m ago•0 comments

Famous Photo of Chernobyl's Dangerous Radioactive Material Was a Selfie (2016)

https://www.atlasobscura.com/articles/elephants-foot-chernobyl
1•downbad_•3m ago•0 comments

OpenAI frontier models and Codex are now available on AWS

https://openai.com/index/openai-frontier-models-and-codex-are-now-available-on-aws/
2•typpo•5m ago•0 comments

AI's reality check has arrived

https://www.fastcompany.com/91551700/ais-reality-check-has-finally-arrived
1•1vuio0pswjnm7•12m ago•0 comments

Terrascan: Explore public deep earth scan datasets

https://terrascan.bowd.io
1•bowd•13m ago•1 comments

AI Grifters Are Making Anti-Data Center Slop with AI

https://www.404media.co/ai-grifters-are-making-anti-data-center-slop-with-ai/
3•cdrnsf•13m ago•0 comments

The Principal IC Moat

https://jchigg2000.dev/#blog/the-principal-ic-moat
1•jchigg2000•15m ago•0 comments

Riding a Spitfire: The Story of Margaret Horton

https://rafa.org.uk/blog/2021/03/08/magaret-horton/
1•omnibrain•16m ago•0 comments

Show HN: Dataroom – a Pi and self-hosted research harness on low-budget GPU

https://github.com/hanxiao/dataroom
1•artex_xh•19m ago•0 comments

Random cat GIFs, every few mins

https://kevinhwong.com/cats-appear
1•kevinwong•20m ago•1 comments

Om Malik – Clothes Are Nice. Fashion Biz, Not as Much

https://om.co/2026/06/01/clothes-are-nice-fashion-biz-not-as-much/
1•rmason•21m ago•1 comments

Show HN: A trend and monthly viewer of the monthly Ask HN: Who's Hiring?

https://hacker-hirings.com
1•awacs•21m ago•0 comments

UtilYard – 55 free browser-based tools (calculators, dev utilities, image tools)

https://utilyard.com
1•mshrod•22m ago•0 comments

Maxime Guillaume patented the axial turbojet in 1921

https://en.wikipedia.org/wiki/Maxime_Guillaume
1•Gravityloss•23m ago•0 comments

Resolving Feynman restaurant problem reveals optimal solutions&human strategies

https://www.pnas.org/doi/full/10.1073/pnas.2509612123
1•bookofjoe•24m ago•0 comments

The Hardest Fork

https://www.chainguard.dev/unchained/the-hardest-fork
1•curmudgeon22•24m ago•1 comments

Chief economist says AI-related job losses aren't happening

https://www.techradar.com/pro/zero-evidence-apollos-chief-economist-says-ai-related-job-losses-ar...
2•drrob•24m ago•0 comments

Complicated truth about European economic stagnation and living standards

https://drthad.substack.com/p/complicated-truth-about-european
2•arthurjj•26m ago•0 comments

Google Seeks to Raise $80B for AI Infrastructure

https://www.wsj.com/tech/ai/google-seeks-to-raise-80-billion-for-ai-infrastructure-05a379be
5•kjhughes•26m ago•1 comments

Remote work – not AI – has sidelined recent college graduates, research finds

https://www.npr.org/2026/06/01/nx-s1-5843076/remote-work-college-graduates-unemployment-ai
1•condensedcrab•29m ago•0 comments

Show HN: Hacker News and Lobsters RSS, repackaged for offline reading

https://github.com/cadamsdotcom/offlinerss
1•cadamsdotcom•31m ago•0 comments

Debugging: Google requests permission to release 32M mosquitoes

https://www.theguardian.com/technology/2026/jun/01/google-permission-release-mosquitoes-californi...
3•ranit•34m ago•0 comments

I built a free AEO/GEO audit tool HTTPS://freeaiwebsiteaudit.com/

2•snowbirdsong•35m ago•0 comments

Bringing Goodnotes to the Web with Swift and WebAssembly

https://www.swift.org/blog/bringing-goodnotes-to-web-with-swift/
3•CharlesW•35m ago•0 comments

University System Went All in on A.I. Now It's Tearing Itself Apart

https://www.nytimes.com/2026/06/01/magazine/ai-university-college-california.html
3•jbredeche•37m ago•0 comments

Show HN: Glq LLM quantization using E8 lattice

https://github.com/cnygaard/glq
1•acd•38m ago•0 comments

Cognitive Packets for Agent Orchestration

https://github.com/JeanHuguesRobert/cogentia/blob/main/research/cognitive_packet_switching.md
1•jhrobert•38m ago•0 comments

Tokens Are the New Transistors

https://www.anantjain.xyz/posts/tokens-are-the-new-transistors
1•anant90•40m ago•0 comments

Show HN: Knotch – a hub-and-spoke voice agent

https://github.com/akshatvasisht/knotch
1•akshatvasisht•41m ago•1 comments

The Pope isn't AGI-pilled

https://www.theverge.com/ai-artificial-intelligence/937933/pope-ai-encyclical-tech-industry-react...
4•1vuio0pswjnm7•42m ago•0 comments