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?

Show HN: RoleSweep – job search that deletes listings when employers close them

https://rolesweep.com
1•chetanba•5m ago•0 comments

Mosaic – self-hosted portfolio analytics for UK Stocks and Shares ISAs

https://github.com/ishantanu/mosaic-portfolio
1•ishantanu10•5m ago•0 comments

SEtting up AI search rank tracking easily

https://github.com/razz1000/ai-search-rank-tracking-example-repo
1•RasmusSoerensen•5m ago•0 comments

TMDB records Apple TV+ air dates a day early, on purpose

https://watchnext.leyu.studio/blog/apple-tv-air-dates-off-by-one
1•oujan•6m ago•0 comments

How to Use the Moshcode CLI

https://anthony.dev.profullstack.com/blog/002-post.html
1•buffer_overlord•6m ago•0 comments

Charisma, confidence and no fear of AI taking their jobs. The personality hires

https://www.marketwatch.com/story/these-workers-have-charisma-confidence-and-no-fear-of-ai-taking...
1•newsomix9xl•6m ago•0 comments

Plannotator – Annotate plans and code reviews for agent feedback

https://github.com/backnotprop/plannotator
1•StrangeSound•10m ago•0 comments

Printing Lists

https://matklad.github.io/2026/08/14/printing-lists.html
2•surprisetalk•10m ago•0 comments

Generate clean, transparent clip art and animated GIFs in seconds

https://clipi.online
1•johndastor•11m ago•0 comments

Show HN: I precompiled the path network of 3 continents to invent hiking routes

https://windygap.app
1•adjohu•13m ago•0 comments

Photo of eclipse by Xiaomi 17 Ultra

https://twitter.com/cvillasante/status/2087657106342105228
2•malshe•13m ago•2 comments

Graph Algorithms on the World Flight Network

https://stochastic.blog/graph-algorithms-on-the-world-flight-network/
1•Anon84•14m ago•0 comments

Terence Tao Lecture: Mathematics in the Age of AI [video]

https://www.youtube.com/watch?v=M0--ZH1lOzg
3•marvinborner•16m ago•0 comments

We Should Use Instrumented Profiling Scopes More

https://mropert.github.io/2026/08/13/instrumented_profiling_scopes/
1•ingve•17m ago•0 comments

Dear people who work at the airport

https://life-after-ssri.bearblog.dev/dear-people-who-work-at-the-airport/
1•nivethan•17m ago•1 comments

We built a tool that helps run your startup

https://app.firmgrove.com
1•firmgrove•20m ago•0 comments

Computer History

https://learn.chatgpt.com/docs/customization/computer-history
1•rbinv•20m ago•1 comments

What Programming and Computing Represent

https://venam.net/blog/programming/2015/11/04/what-is-programming.html
1•speckx•20m ago•0 comments

Who's Tracking You? Use This New Service to Find Out

https://krebsonsecurity.com/2026/08/whos-tracking-you-use-this-new-service-to-find-out/
2•DemiGuru•21m ago•0 comments

Why Is No One Talking About the Manufacturing Boom?

https://www.dailysignal.com/2026/08/11/quiet-manufacturing-boom/
1•bilsbie•23m ago•1 comments

My VP Eng told me to stop working on observability

https://www.jevy.org/articles/my-vp-eng-told-me-to-stop-working-on-observability/
1•jevyjevjevs•24m ago•0 comments

Goyda: Cross-Platform UI Toolkit

https://github.com/user-with-username/goyda
1•anybodyy•25m ago•1 comments

Show HN: Artifex - Graph Based GPU Harness for AI Agents

https://gatewai.studio/artifex
2•oknaslnkn•26m ago•0 comments

The Secret, Open Triumph of Race Science

https://www.richardhanania.com/p/the-strange-secret-open-triumph-of
1•bilsbie•27m ago•0 comments

Quick thoughts on watching a solar eclipse

https://blog.borrego.dev/entries/quick-thoughts-on-watching-a-solar-eclipse.html
1•agubelu•27m ago•0 comments

Computing Graph Dominators

https://neugierig.org/software/blog/2026/08/dominators.html
1•ingve•28m ago•0 comments

Show HN: Rdio – an open-source internet radio control suite

https://rdio-docs.vercel.app
3•taqibrahim•28m ago•0 comments

169M offer decisions a month on 0.77 CPU cores

https://emergent.sh/blog/how-our-pricing-engine-evolved-from-an-if-ladder
1•SamraatBansal•29m ago•0 comments

Solar helps 'stabilise' Europe's grids as heatwaves spike power demand

https://www.euronews.com/2026/08/14/the-real-challenge-starts-after-sundown-europes-heatwave-boos...
1•vrganj•29m ago•0 comments

Show HN: Gnat – self-hosted analytics as a single Go binary with MCP server

https://github.com/var-raphael/Gnat
2•Raphael_Dev•34m ago•0 comments