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?

Trump says U.S. working on deal to buy potash from Belarus instead of Canada

https://www.cbc.ca/lite/story/9.7352583
1•colinprince•25s ago•0 comments

Markdown in /src

https://htmx.org/essays/markdown-in-src/
1•perrygeo•5m ago•0 comments

Self-hosted, end-to-end encrypted 1:1 chat app. Offline key-exchange

https://github.com/pkMinhas/walkytalky-private-messenger
1•pkMinhas•6m ago•0 comments

Show HN: Transom – easily manage multiple browser profiles on macOS

https://github.com/darvid/transom
1•darvid•8m ago•0 comments

Where do AI norms come from?

https://charity.wtf/p/where-do-ai-norms-come-from
1•BerislavLopac•10m ago•0 comments

Bitrig Now Builds iPhone Duo Apps

https://bitrig.com/blog/bitrig-builds-iphone-duo-apps
1•alwillis•11m ago•0 comments

Do not fear AI. Fear AI companies

https://df7sc6o35ljoz.cloudfront.net/posts/do-not-fear-ai-rev-2.html
4•rDr4g0n•13m ago•0 comments

An LLM Beat NetHack

https://kenforthewin.github.io/blog/posts/llm-nethack-ascension/
1•kenforthewin•13m ago•0 comments

Singapore auctions luxury goods seized in $2.4B money-laundering bust

https://www.cnn.com/2026/09/14/style/singapore-money-laundering-auctions
1•kelt•14m ago•0 comments

Tupo: A daily sudoku-style logic puzzle with a colorful twist

https://playtupo.com/
1•slymax•14m ago•0 comments

Entropy Is Spare Capacity

https://fffej.substack.com/p/entropy-is-spare-capacity
1•mooreds•16m ago•0 comments

Show HN: Ultracapitalism, a Company-Building Autobattler

https://ultracapitalism.io/play/
1•ChromaGolem•17m ago•0 comments

Show HN: A Dice Roguelike

https://www.reddit.com/r/roguelites/s/hSYBj5jri9
1•selimonder•18m ago•0 comments

Data Protection Commission fines Google €403M over processing of location data

https://www.dataprotection.ie/en/news-media/latest-news/data-protection-commission-fines-google-e...
13•DeepLogin•19m ago•3 comments

Advice for finding a technical co-founder (2021)

https://www.mooreds.com/wordpress/archives/3445
2•mooreds•21m ago•0 comments

B5-BJ2 – Ice Cream Barges – Concrete Ship Constructors

https://thecretefleet.com/blog/f/b5-bj2---ice-cream-barges---concrete-ship-constructors
2•nixass•22m ago•0 comments

I don't want to read what you didn't write

https://blog.colinbreck.com/i-dont-want-to-read-what-you-didnt-write/
30•mooreds•22m ago•3 comments

Turn your Mac notch into an arcade

https://notcharcade.com/
2•danilovilhena•24m ago•0 comments

Trump TV: The Essentials Station [video]

https://www.youtube.com/watch?v=A4gNgHfZ-v4
1•ortusdux•24m ago•0 comments

A Call for Control of Frontier AI Models

https://www.presidentti.fi/en/a-call-for-control-of-frontier-ai-models/
2•gone35•24m ago•0 comments

Almost started a war: Report reveals dark reality as AI permeates civilisation

https://www.news.com.au/technology/innovation/military/almost-started-a-war-report-reveals-dark-r...
3•striker44•26m ago•0 comments

Show HN: Laya decision engine on AWS Lambda, backed by Lambda SnapStart

https://github.com/HQarroum/laymbda
1•hqm_•28m ago•0 comments

Newly Discovered Neo 2026SC Will Improve Orbital Refinement Education

https://www.astrophyzix.com/2026/09/neo-asteroid-2026SC.html
1•UniverseToday•28m ago•0 comments

Igalia Celebrates "Twenty-Five Years Upstream"

https://lwn.net/Articles/1095723/
1•debo_•30m ago•0 comments

How to talk about "AI" without adding to the anthropomorphization

https://buttondown.com/maiht3k/archive/how-to-talk-about-ai-without-adding-to-the/
1•cdrnsf•30m ago•1 comments

Unattended 24hr Full-Stack Build: Qwen 3.8 27B on a Single RTX 5090

https://github.com/anglepoiselife/Self-Directed-Agent/blob/main/INTRODUCTION.md
2•anglepoiselife•33m ago•0 comments

Information is Matter is Energy

1•sans_souse•34m ago•0 comments

Show HN: SoTA Feed – Every open-weights release from the labs that matter

https://sota.borgcloud.ai/
1•lostmsu•34m ago•0 comments

Solitaire Alone Together

https://solitairealonetogether.com/
3•eieio•37m ago•0 comments

Child Welfare Technology System Shows Minimal Progress After 10 Years and $2B

https://aspe.hhs.gov/reports/ccwis-implementation-shows-minimal-progress
6•jsolomon•39m ago•1 comments