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?

TigerBeetle Core System Architecture: Deconstructing Performance Engineering

https://ixuvo.com/blog/tigerbeetle-core-system-architecture-performance-engineering
1•ksec•2m ago•0 comments

Show HN: Music Mini Games on the Web (1.0)

https://musicminigames.com/games/
1•calflegal•3m ago•1 comments

Apple Reportedly Lays Off 60 Vision Products Group Employees

https://www.macrumors.com/2026/08/21/apple-lays-off-vision-products-employees/
2•mgh2•5m ago•0 comments

A simple, free CV builder with no paywalls or watermarks

https://cvora.art/es
1•teapotv•7m ago•0 comments

China Hunts for Scientific Talent. The U.S. Is Making It Easier.

https://www.nytimes.com/2026/08/17/business/china-scientific-talent-competition.html
2•bookofjoe•8m ago•1 comments

Ask HN: What is the best AI Video studio

2•BrucecarlL•10m ago•0 comments

Unbounded Data – How to Stop Hitting Yourself with Infinite Punches

https://coward.mataroa.blog/blog/unbounded-data/
1•cowards_way_out•10m ago•0 comments

Rise of the Borderless Founder

https://a16z.com/rise-of-the-borderless-founder/
1•shadag•11m ago•0 comments

Waterfox 6.7.0 – Supernova

https://www.waterfox.com/releases/6.7.0/
1•kmfrk•11m ago•0 comments

It's not enjoyable to make music now (SUE SUNO) [video]

https://www.youtube.com/watch?v=GejdMIM2Tjk
1•askl•15m ago•0 comments

BoostBoard.io – a paid leaderboard where every rank shows its real traffic

https://boostboard.io
1•derlebach•15m ago•0 comments

Grok Imagine 1.5 prompts for product, UGC, and dialogue clips

https://seaimagine.com/model/grok-imagine-1-5/
1•taynes•16m ago•0 comments

Jason Arday and the new politics of plagiarism

https://theconversation.com/jason-arday-and-the-new-politics-of-plagiarism-290020
1•chmaynard•17m ago•0 comments

I built a YouTube looper with A-B repeat and per-video memory

https://repeat-videos.com/
1•Cayacoa•18m ago•0 comments

Ask HN: Do teams really need to use GitHub?

2•avinoth•18m ago•0 comments

AI(.)DIY – Open-source AI workspace with agents, MCP and Linux in the browser

https://github.com/Cubinghackerz/ai.diy
1•nirneet•20m ago•0 comments

Show HN: BlockDex – item-level search across every public Shadcn registry

https://blockdex.kynth.studio
1•kyisaiah47•20m ago•0 comments

ChatSDK Ruby: One Gem, Every Channel

https://blog.quent.in/blog/2026/07/19/chat-sdk-ruby-one-gem-every-channel/
1•sylvainkalache•21m ago•0 comments

Chinese FM to visit Seoul as Lee floats multiparty talks on ending Korean War

https://www.koreaherald.com/article/10844465
1•thisislife2•27m ago•0 comments

Microsoft gives Task Manager another task: Watching AI workloads

https://www.theregister.com/os-platforms/2026/08/20/microsoft-gives-task-manager-another-task-wat...
1•smurda•29m ago•0 comments

Bandai don't sue me please

https://github.com/Irtaza2009/Hackamon
3•Irtaza1•29m ago•0 comments

Show HN: Snapped – A slow, analog-first social network

https://snapped.pics/
1•jeswin•29m ago•1 comments

Show HN: Local design and video editor with in-browser 4K MP4 export

https://github.com/karamuhammet/Open-Editor-Dika-Studio-Community
2•muhammetck•30m ago•0 comments

Show HN: ContextForge – context engineering platform for AI-assisted development

https://github.com/waterflane/ContextForge
2•waterflane•31m ago•0 comments

Carthage should be destroyed (2015) (149 BCE)

https://skeptoid.com/blog/2015/05/10/furthermore-i-am-of-the-opinion-that-carthage-should-be-dest...
1•pastage•32m ago•0 comments

Bringing Rails into the Ractor-Age

https://railsatscale.com/2026-08-11-ractors-on-rails/
1•ksec•35m ago•1 comments

Show HN: Lunar, a coding harness extensible with Lua

https://github.com/gszr/lunar
4•gszr•38m ago•2 comments

Kino: A high-performance Ractor web server for Ruby 4.0

https://github.com/yaroslav/kino
2•ksec•39m ago•1 comments

Product, Aristra, Is Craaaazy

https://app.aristralabs.com/sign-in?redirect_url=https%3A%2F%2Fapp.aristralabs.com%2F
1•player08•39m ago•1 comments

US envoy Huckabee tells Israeli settlers not to take Palestinian Americans' land

https://www.reuters.com/world/middle-east/us-envoy-huckabee-tells-israeli-settlers-not-take-pales...
1•bewareofscams•40m ago•0 comments