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?

Show HN: I made an API letting people search in real AI – human conversations

https://apify.com/aiso/aiso-conversations-intelligence
1•bentannen•1m ago•0 comments

Interactive Periodic Table of Oil shows key streams in global oil markets

https://www.spglobal.com/energy/en/news-research/infographics/content-design-infographics/platts-...
1•felineflock•2m ago•0 comments

BrokenArXiv: How often do LLMs claim to prove false theorems?

https://matharena.ai/brokenarxiv/
1•robinhouston•2m ago•0 comments

Comprehension Debt – the hidden cost of AI generated code

https://addyosmani.com/blog/comprehension-debt/
1•cdrnsf•3m ago•0 comments

When do you get 2× Claude?

https://site.aignited.id/claude-2x.html
1•Alifatisk•3m ago•0 comments

Ladybird Browser Is in for a Rusty Future [video]

https://www.youtube.com/watch?v=fXnuR6nXJzc
1•atombender•6m ago•0 comments

Canada and Nordics seek closer 'middle power' cooperation

https://www.reuters.com/world/americas/canada-nordics-seek-closer-middle-power-cooperation-2026-0...
1•madspindel•7m ago•0 comments

Ukraine opens battlefield data access to allies' AI models

https://www.reuters.com/business/aerospace-defense/ukraine-opens-battlefield-data-access-allies-a...
1•e12e•8m ago•1 comments

Why Hollywood Is Facing a Unhappy Ending [video]

https://www.youtube.com/watch?v=VJ_kPcLAKv0
1•mgh2•8m ago•0 comments

Deep-sea natural compound targets cancer cells through a dual mechanism

https://phys.org/news/2026-03-deep-sea-natural-compound-cancer.html
1•Brajeshwar•9m ago•0 comments

The modern formatting addiction in writing

https://dynomight.substack.com/p/formatting
1•walterbell•10m ago•0 comments

Compiling to WebAssembly

https://ktye.github.io/wa/
1•tosh•11m ago•0 comments

MacBook Neo Is the Most Repairable MacBook in 14 Years

https://www.ifixit.com/News/116152/macbook-neo-is-the-most-repairable-macbook-in-14-years
4•FrojoS•11m ago•0 comments

Brazil publishes a list of companies needing age verification, includes Ubuntu

https://www.gov.br/anpd/pt-br/assuntos/noticias/em-acao-de-monitoramento-do-eca-digital-a-anpd-es...
3•iamnothere•11m ago•2 comments

MacBook Neo emerges as company's most repairable laptop in more than a decade

https://www.reuters.com/world/china/apple-macbook-neo-emerges-companys-most-repairable-laptop-mor...
1•FrojoS•12m ago•0 comments

Networked Thought

https://jzhao.xyz/posts/networked-thought
2•parksb•14m ago•0 comments

jtye: k in fifty functions

https://ktye.github.io/jtye/index.html
1•tosh•15m ago•0 comments

Show HN: Score your engineering practices from GitHub/Jira

https://www.getconcordance.com/welcome
1•irishtel•15m ago•1 comments

Taiwan reports large-scale Chinese military aircraft presence near island

https://www.politico.com/news/2026/03/15/taiwan-reports-large-scale-chinese-military-aircraft-pre...
1•optimalsolver•16m ago•0 comments

Out-of-Context Reasoning in LLMs: A short primer and reading list

https://outofcontextreasoning.com/
1•amstam•18m ago•1 comments

Show HN: RSS tool to remix feeds, build from webpages, and skip podcast reruns

https://sponder.app
2•kristjan•20m ago•0 comments

J Stack Language

https://ktye.github.io/j.html
1•tosh•21m ago•0 comments

Koredex– Bot that automatically fixes failing pytest tests and proves it worked

https://drive.google.com/file/d/12G1M7GMFJk7x-4LN9KSohG9smZ7qFDaI/view?usp=drivesdk
1•abhinav300j•22m ago•1 comments

GaN-based power devices: Physics, Reliability, and Perspectives

https://pubs.aip.org/aip/jap/article/130/18/181101/1025623/GaN-based-power-devices-Physics-reliab...
1•rramadass•22m ago•0 comments

Show HN: Lag – Super fast comms (now avail on CLI)

https://github.com/lag-app/cli
1•paulgardiner•22m ago•0 comments

Show HN: Dialtone watcher – what is my laptop doing and am I normal

2•fcpguru•23m ago•0 comments

Scrum Masters, Don't Fall for the Abilene Paradox

https://www.scrum.org/resources/blog/scrum-masters-dont-fall-abilene-paradox
1•cyber_kinetist•23m ago•0 comments

Waymo Fun: The Self-Driving Car Revolution

https://www.nationalreview.com/magazine/2026/04/waymo-fun-the-self-driving-car-revolution/
1•fortran77•23m ago•1 comments

Codegen Is Not Productivity

https://www.antifound.com/posts/codegen-is-not-productivity/
2•donutshop•23m ago•0 comments

An x86-64 back end for raven-uxn

https://www.mattkeeter.com/blog/2026-03-15-uxn/
4•dcre•24m ago•0 comments