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

Services Masquarading as Software 30x30

https://www.silverbackcto.com/
1•dudemanAtl•2m ago•0 comments

Show HN: NostalgiApp – A LaunchBox-style game launcher for macOS

3•jupe69•4m ago•0 comments

The Return of the Unix Workstation (Now with AI)

https://jasoneckert.github.io/myblog/return-of-the-unix-workstation/
1•ingve•5m ago•0 comments

The Return to Analog

https://www.rickmanelius.com/p/the-return-to-analog
1•mooreds•5m ago•0 comments

AAuth Protocol Explorer

https://explorer.aauth.dev/
1•mooreds•6m ago•0 comments

Prefer Terraform Module Composition over Inheritance (2025)

https://newsletter.masterpoint.io/p/prefer-module-composition-over-inheritance
1•mooreds•7m ago•0 comments

Embrace, Extend, Extinguish?

http://eee.fyi/
2•pie_flavor•10m ago•0 comments

Entity Component Systems FAQ

https://github.com/SanderMertens/ecs-faq
2•tosh•12m ago•0 comments

Ask HN: What sci fi books are you reading now?

2•pianetanaif•13m ago•2 comments

Microsoft Lead: "AI Will Never Replace Coders, Here's Why" [video]

https://www.youtube.com/watch?v=CPrePbvbbic
4•tosh•19m ago•0 comments

We accidentally recreated old Facebook

https://amrshawky.com/posts/we-accidentally-recreated-fb/
1•amr_shawky•21m ago•0 comments

Detecting PostgreSQL optimization issues with deterministic analysis

https://beh74.github.io/pgassistant-blog/post/global_advisor/
1•bertrandhartwig•21m ago•0 comments

Scientists warn Atlantic current at risk of shutting down

https://e360.yale.edu/features/amoc-climate-change
35•ambigious7777•22m ago•5 comments

Visualizing LLM embeddings on a sphere

https://github.com/dbyter/sphere-embed
1•ahmedhawas123•23m ago•1 comments

Boilerplate to create a 1990s Geocities-style website

https://sugardaddyapp.github.io/geocities-boilerplate/
1•whatsupdog•24m ago•1 comments

Hacking Police Robot Dogs [video]

https://www.youtube.com/watch?v=lA8WuXDXfcI
1•Jn2G3Np8•26m ago•0 comments

Russia Restricting Access to GitHub

https://twitter.com/polidemitolog/status/2053493261633720827
6•miohtama•29m ago•0 comments

Show HN: We built a tool to dub any video in the original voice in 30 languages

1•ABSALOMMAXY•32m ago•1 comments

AI Learns to Play Pokémon Go on AI Sandboxes

https://zozo123.github.io/pokeloop/
1•zozo123-IB•33m ago•0 comments

Map of every park in Salt Lake City

https://saltlake.citycast.fm/parks
1•bencornia•35m ago•0 comments

The Fall of the Theorem Economy

https://davidbessis.substack.com/p/the-fall-of-the-theorem-economy
3•magoghm•35m ago•0 comments

Do City Delivery Drones Make Sense? No One Knows, but They're Flying over NYC

https://www.wired.com/story/do-city-delivery-drones-make-sense-no-one-knows-but-theyre-flying-ove...
1•Brajeshwar•39m ago•0 comments

B-tree based collection types for Go

https://github.com/tidwall/btype
4•eatonphil•39m ago•0 comments

Chrome's AI features may be hogging 4GB of your computer storage

https://www.theverge.com/tech/924933/google-chrome-4gb-gemini-nano-ai-features
12•birdculture•39m ago•4 comments

Its the Age of Electricity and America Isn't Ready

https://www.nytimes.com/interactive/2026/04/27/opinion/electricity-power-grid-infrastructure.html
3•anjel•41m ago•1 comments

TikZlings – A collection of cute little animals and similar creatures

https://ctan.org/pkg/tikzlings?lang=en
1•Tomte•44m ago•0 comments

Why payment escrow for AI agents needed a different design

https://streetai.org/blog/escrow-for-ai-agents.html
2•degutemesgen•46m ago•0 comments

A super simple tool tells you who called the function and who implemented it

https://github.com/meloalright/who-ast
3•meloyc•47m ago•0 comments

Proposed Amendment to the Telephone Consumer Protection Act of 1991

https://www.karlbunch.com/random/website-protection-act/
2•kator•48m ago•1 comments

OSS Review Toolkit

http://oss-review-toolkit.org/ort/
2•Tomte•53m ago•0 comments