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?

Life in My Twenties

https://fjlin.me/life-in-my-twenties
1•unitcircle69•44s ago•0 comments

Show HN: Vendorlobby – AI intake for cold emails, calls, and LinkedIn pitches

https://vendorlobby.com
1•ignsl•1m ago•0 comments

Show HN: A curated directory of AI affiliate programs, updated monthly

https://aiafflist.com/
1•Odeh13•1m ago•0 comments

Show HN: JobZap – Chrome extension for filtering LinkedIn job search

https://github.com/its-monotype/jobzap
1•monotype•3m ago•0 comments

Show HN: RemotePilot: Track Remote Opportunities

https://remotepilot.dev/
1•introvertmac•4m ago•0 comments

Infographics for Caching

https://bytebytego.com/guides/caching-performance/
1•anandvashishtha•8m ago•0 comments

The Three Virtues of a Great Programmer

https://thethreevirtues.com/
2•rbanffy•11m ago•0 comments

Amdahl's Law for LLM generated code

1•akiarie•11m ago•1 comments

US Law Enforcement Warns of 'Anti-Tech Extremism'

https://www.wired.com/story/us-law-enforcement-warns-of-anti-tech-extremism/
1•hansmayer•13m ago•0 comments

Show HN: Agent Launch – One CLI for Codex, Claude Code, Cursor, Gemini, OpenCode

1•dhruv_anand•14m ago•0 comments

Show HN: Marketing Manager Job Board

https://marketingmanagerjobs.com/
1•35mm•15m ago•0 comments

GitHub just suspended GitHub-actions[bot]

4•jaakkonen•15m ago•0 comments

Sam Altman: I was wrong, AI unlikely to lead to jobs apocalypse

https://www.reuters.com/world/asia-pacific/openais-altman-says-ai-unlikely-lead-jobs-apocalypse-2...
2•dryadin•15m ago•0 comments

I spent 2 months building a business problem roulette

https://www.gotaprob.com/discover/spin
2•syel•18m ago•1 comments

Blip Voice: solve a painful bug in WhatsApp

https://github.com/mohamadd-khalill/blip-voice
1•mohamaddkhalill•20m ago•1 comments

Incident with Actions and Pages

https://www.githubstatus.com/incidents/gnftqj9htp0g
11•hakube•22m ago•3 comments

Apple has an innovation gap. Will its new CEO fill it?

https://www.ft.com/content/d16f3ae6-8e27-4293-8bef-6bda7a9706d2
2•giuliomagnifico•24m ago•1 comments

CodeMySpec – Lovable for engineers who care about the code

https://codemyspec.com/products/code-my-spec
3•matthewsinclair•26m ago•0 comments

A reality check on the AI jobs hysteria

https://www.technologyreview.com/2026/05/26/1137855/a-reality-check-on-the-ai-jobs-hysteria/
2•joozio•28m ago•0 comments

Imec presents quantum dot qubit device using High NA EUV lithography

https://www.imec-int.com/en/press/world-first-imec-presents-quantum-dot-qubit-device-using-high-n...
1•u1hcw9nx•28m ago•1 comments

Show HN: The Structural Operating System for the AI Era

https://typerion.io
1•Techman92•29m ago•0 comments

FinOps for AI: Track What Your Code Costs per Commit

https://mooracle.io/blog/finops-ai-planning-poker/
1•theanonymousone•30m ago•0 comments

Egypt's Great Pyramid is also a great earthquake dampener

https://www.science.org/content/article/egypt-s-great-pyramid-also-great-earthquake-dampener
1•tzury•30m ago•0 comments

Harness, Scaffold, and the AI Agent Terms Worth Getting Right

https://huggingface.co/blog/agent-glossary
1•sergiopaniego•30m ago•0 comments

Collapse of Personal Computing – Investigation into the Destruction of Ownership [video]

https://www.youtube.com/watch?v=zyQwAhppWj8
1•alecco•32m ago•0 comments

What if every input, search and list was predictive?

https://aito.ai/blog/the-predictive-application/
1•arauhala•32m ago•0 comments

Basecamp Five

https://world.hey.com/dhh/basecamp-five-8fcfd2ef
3•software_writer•35m ago•0 comments

Daily Murder: a daily whodunit puzzle solved by logic on an elimination grid

https://dailymurder.com
1•KeepComputing•35m ago•0 comments

My Favorite Fable

https://sive.rs/horses
1•Michelangelo11•36m ago•0 comments

Skill to Income Mapping Engine

https://www.tooldocket.com/2026/05/skill-to-income-calculator.html
3•stoicstoic•36m ago•1 comments