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•10mo 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•10mo 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•10mo 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•10mo 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•10mo ago
Load test against a clone instead of a DB whose contents you care about?

Secure Programming How to (2015)

https://dwheeler.com/secure-programs/
1•rramadass•1m ago•1 comments

`new Date()` Considered Harmful

https://futuresearch.ai/blog/javascript-thinks-everythings-a-date/
1•rgambee•2m ago•0 comments

Show HN: Site got cited by Claude and ChatGPT in under a week

https://www.superchargebrowser.com/
1•superchargeext•3m ago•0 comments

Aliens.gov

https://whois.domaintools.com/aliens.gov
1•someprick•3m ago•0 comments

Fun with the Web

https://patrickbrosset.com/articles/2026-01-06-fun-with-the-web/
1•speckx•5m ago•0 comments

AI powered analysis of public sector invoices in Sweden by Jens Nylander

https://kommun.jensnylander.com
1•bjornroberg•5m ago•0 comments

Show HN: Deariary – An automated diary generated from the tools you use

https://deariary.com/en
1•unhappychoice•6m ago•0 comments

What It Might Be Like to Live in Viriconium

https://fantasticmetropolis.com/i/viriconium/
1•riffraff•6m ago•0 comments

Show HN: OpenGranola – meeting copilot that searches your notes in real time

1•yazinsai•6m ago•0 comments

How you walk reveals to others how you are feeling, researchers say

https://www.theguardian.com/science/2026/mar/18/how-you-walk-reveals-to-others-how-you-are-feelin...
1•giuliomagnifico•7m ago•0 comments

UK, Finland, Netherlands consider joint defence financing, procurement

https://www.reuters.com/business/aerospace-defense/uk-finland-netherlands-consider-joint-defence-...
2•vrganj•7m ago•0 comments

Weasyprint: Web-Based Document Design

https://weasyprint.org/
1•dtj1123•7m ago•0 comments

The tool is not important

https://kinocow.com/the-tool-is-not-important
1•syliconadder•8m ago•0 comments

5x SSR Throughput: Profiling SSR Hot Paths in TanStack Start

https://tanstack.com/blog/tanstack-start-5x-ssr-throughput
1•master-hash•9m ago•0 comments

Elon Musk and SEC in talks to settle lawsuit over Twitter deal

https://www.cnbc.com/2026/03/17/elon-musk-sec-in-talks-to-settle-government-lawsuit-over-twitter-...
1•1vuio0pswjnm7•9m ago•0 comments

FDA links raw cheese to outbreak; Makers "100% disagree," refuse recall

https://arstechnica.com/health/2026/03/fda-links-raw-cheese-to-outbreak-makers-100-disagree-refus...
2•rbanffy•9m ago•0 comments

Study: Top AI coding tools make mistakes one in four times

https://uwaterloo.ca/news/media/top-ai-coding-tools-make-mistakes-one-four-times
1•giuliomagnifico•10m ago•1 comments

Trace: A Declarative Modeling Spec Format for the AI Age

https://tonyalicea.dev/blog/trace-declarative-modeling-ai-age/
1•TonyAlicea10•10m ago•0 comments

Show HN: Mimir – open-source code intelligence for AI agents (Go, MCP, SQLite)

1•thuongne•11m ago•0 comments

Hardwood: Parser for the Parquet file format (minimal dependencies, Java)

https://github.com/hardwood-hq/hardwood
1•articsputnik•11m ago•0 comments

Show HN: CLI to score AI prompts after a prod failure

https://costguardai.io
1•techcam•12m ago•1 comments

Microsoft Learning Center shows AI generated image with two Start buttons

https://videocardz.com/newz/microsoft-windows-11-learning-center-shows-ai-generated-image-with-tw...
1•LorenDB•13m ago•0 comments

Dark matter experiment reaches ultracold milestone

https://phys.org/news/2026-03-dark-ultracold-milestone.html
2•Brajeshwar•14m ago•0 comments

Parents think they know how kids use AI. They don't

https://buzznews.com/news/3a6c97be-daa5-42b8-9ac0-48e7f25428bb
1•buzznewswebsite•14m ago•0 comments

Show HN: A single pane of glass for Claude Code

https://github.com/jasonwilmot/singlepane
1•jasondigitized•14m ago•0 comments

Show HN: Parsing hostile industrial data in 64MB WASM sandboxes

https://ingelt.com
1•bneb-dev•15m ago•0 comments

Mere: A New Package Manager

https://merelinux.org/posts/new-pm/
2•jhuntwork•15m ago•0 comments

Is Music Just Sound? A creative technologist's perspective on AI-generated music

https://perthirtysix.com/is-music-just-sound
2•datadrivenangel•17m ago•1 comments

MiniMax M2.7 (200K context, $0.30/1.20) released

https://openrouter.ai/minimax/minimax-m2.7
1•pixel_popping•17m ago•0 comments

The fiery, deadly crashes involving the Tesla Cybertruck

https://www.theguardian.com/technology/2026/mar/18/tesla-cybertruck-crashes-battery-fires
2•t-vi•17m ago•0 comments