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

Show HN: HN Alerts

https://hnalerts.com/
1•davidbarker•41s ago•0 comments

Is France standing up for encryption and privacy?

https://tuta.com/blog/france-law-encryption
1•pabs3•2m ago•0 comments

SmartTube App Publishing Key Exposed

https://www.patreon.com/posts/144473602
1•akersten•2m ago•0 comments

The GitHub Infrastructure Powering North Korea's Contagious Interview NPM

https://socket.dev/blog/north-korea-contagious-interview-npm-attacks
1•feross•3m ago•0 comments

Education your developers never got

https://doingsoftwarewrong.com/blog/support-as-learning/
1•ChunkyAu•4m ago•0 comments

Big batteries hit world-leading 40 pct share of evening demand

https://reneweconomy.com.au/big-batteries-hit-world-leading-40-pct-share-of-evening-demand-in-stu...
1•locallost•7m ago•0 comments

Amazon Route 53 launches Accelerated recovery for managing public DNS records

https://aws.amazon.com/blogs/aws/amazon-route-53-launches-accelerated-recovery-for-managing-publi...
1•gslin•8m ago•1 comments

The Little Thoughts Of Thinking Machines (1983) [pdf]

https://www-formal.stanford.edu/jmc/little.pdf
2•optimalsolver•9m ago•0 comments

Public markets differ from farmers markets (2013)

https://www.canr.msu.edu/news/public_markets_differ_from_farmers_markets
1•marysminefnuf•9m ago•0 comments

'Slender Man' stabber recaptured. A timeline of the original case

https://www.cnn.com/2025/11/25/us/morgan-geyser-timeline-slender-man
1•Bender•9m ago•0 comments

Why Does Ozempic Cure All Diseases? (2024)

https://www.astralcodexten.com/p/why-does-ozempic-cure-all-diseases
1•throwaway2037•10m ago•0 comments

Crypto hoarders dump tokens as shares tumble

https://arstechnica.com/information-technology/2025/11/crypto-hoarders-dump-tokens-as-shares-tumble/
3•Bender•12m ago•0 comments

Is Queens the new political bellwether of America?

https://www.theguardian.com/commentisfree/2025/nov/26/queens-political-bellwether-america
1•handfuloflight•14m ago•0 comments

3D Printing from the Latent Space

https://twitter.com/moridinamael/status/1993832920822530437
1•mordymoop•15m ago•1 comments

YouTube Video Recipe Search

https://recipes.justshare.io/
1•breadchris•23m ago•0 comments

100 years on, T.S. Eliot's The Hollow Men is a poem for our populist moment

https://theconversation.com/100-years-on-t-s-eliots-the-hollow-men-is-a-poem-for-our-populist-mom...
2•defrost•27m ago•0 comments

HashJack Indirect Prompt Injection Weaponizes Websites

https://www.infosecurity-magazine.com/news/hashjack-indirect-prompt-injection/
1•GaryBluto•31m ago•0 comments

Walrus – a distributed message streaming engine (Rust)

2•puterbonga•31m ago•1 comments

Tesla's European sales tumble nearly 50% in October

https://finance.yahoo.com/news/teslas-european-sales-tumble-nearly-50-in-october-143329063.html
4•doener•35m ago•1 comments

Show HN: AroundHere – Location based Wiki/Grokipedia explorer with summary/TTS

https://aroundhere.app
2•j-b•37m ago•0 comments

Event Sourcing Is Not for Everyone

https://docs.eventsourcingdb.io/blog/2025/11/27/event-sourcing-is-not-for-everyone/
1•goloroden•39m ago•0 comments

Babushka Lady

https://en.wikipedia.org/wiki/Babushka_Lady
5•thunderbong•40m ago•0 comments

Ask HN: Is all AI coded code in the public domain?

4•e12e•40m ago•4 comments

New User Trends on Wikipedia

https://wikimediafoundation.org/news/2025/10/17/new-user-trends-on-wikipedia/
2•gslin•43m ago•0 comments

Sutskever and LeCun: Scaling LLMs Won't Yield More Useful Results

https://www.abzglobal.net/web-development-blog/ilya-sutskever-yann-lecun-and-the-end-of-just-add-...
4•birdculture•46m ago•0 comments

Ben redesigned the BoM website at a fraction of its $96.5M cost

https://www.smh.com.au/technology/premium-prices-for-a-downgrade-96-5-million-bom-website-savaged...
3•matthewsinclair•49m ago•1 comments

Everything we know about DC shooter who attacked two National Guardsmen

https://www.dailymail.co.uk/news/article-15329875/washington-dc-shooter-national-guardsman-suspec...
2•Bender•53m ago•0 comments

Bun Security Scanner API

https://bun.com/docs/pm/security-scanner-api
2•nateb2022•56m ago•0 comments

C100 Developer Terminal

https://caligra.com/
14•matthewsinclair•57m ago•6 comments

Show HN: A computer-use Mac client for Claude Opus 4.5

https://github.com/pravaco/cuaview-releases
2•sdan•1h ago•1 comments