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?

American Technology Revolution Reveals Disturbing Non-Human Influence

https://politicalsaucer.substack.com/p/the-case-for-invasion-american-technology
1•DisclosureUS•13s ago•0 comments

Landauer's Principle

https://en.wikipedia.org/wiki/Landauer%27s_principle
1•downboots•23s ago•0 comments

How to Get Hired in 2025

https://tonsky.me/blog/hiring-ai/
1•genericlemon24•1m ago•0 comments

BA Tools, MCP server for sprint planning, velocity, Moscow prioritization

https://github.com/cs97jjm3/ba-workflow-tools
1•cs97jjm3•2m ago•1 comments

What's New in Oracle Solaris 11.4 SRU 87

https://blogs.oracle.com/solaris/whats-new-in-oracle-solaris-11-4-sru-87
1•cf100clunk•3m ago•0 comments

US orders H-1B spouses, kids to keep social media public from Dec 15

https://www.business-standard.com/amp/immigration/us-orders-h-1b-spouses-kids-to-keep-social-medi...
1•chequoredDaemon•4m ago•0 comments

WebDriver BiDi+ – JavaScript translation layer between CDP and BiDi

https://github.com/GoogleChromeLabs/chromium-bidi
1•keepamovin•4m ago•0 comments

Typewriter Pen Plotters

https://biosrhythm.com/?p=2143
1•fanf2•5m ago•0 comments

Star Wars Returns in February of 2027 in Its Original 1977 Theatrical Release

https://www.ign.com/articles/star-wars-returns-to-theaters-in-february-of-2027-in-its-original-19...
1•trauco•9m ago•0 comments

4B If Statements

https://andreasjhkarlsson.github.io//jekyll/update/2023/12/27/4-billion-if-statements.html
2•damethos•13m ago•0 comments

Muen – An x86/64 Separation Kernel for High Assurance

https://muen.codelabs.ch/
1•LiamPowell•14m ago•1 comments

$100k Robot Dogs That Look Like Billionaires? The Artist Explains

https://www.wsj.com/arts-culture/fine-art/beeple-robot-dogs-regular-animals-art-basel-nft-84043fb9
1•cs702•14m ago•0 comments

The Missing Device That Changes AI Forever – The Story of the Memristor [video]

https://www.youtube.com/watch?v=AHZxhdjCBSo
1•lucavice•16m ago•0 comments

The Silent Leak: How One Line of Go Drained Memory Across Goroutines

https://medium.com/harness-engineering/the-silent-leak-how-one-line-of-go-drained-memory-across-t...
2•gearnode•20m ago•0 comments

Treating Documentation as a Product

https://compositecode.blog/2025/12/03/treating-documentation-as-a-product/
1•Kerrick•20m ago•0 comments

Dolt Is as Fast as MySQL on Sysbench

https://www.dolthub.com/blog/2025-12-04-dolt-is-as-fast-as-mysql/
1•thunderbong•21m ago•0 comments

What Is Modal?

https://modal.cx/blog/what-is-modal/
1•todsacerdoti•21m ago•0 comments

OpenAI has trained its LLM to confess to bad behavior

https://www.technologyreview.com/2025/12/03/1128740/openai-has-trained-its-llm-to-confess-to-bad-...
1•cainxinth•25m ago•1 comments

The Cult of Therapy

https://www.profgalloway.com/the-cult-of-therapy/
1•Brajeshwar•25m ago•0 comments

A New Governing Ecosystem Is Evolving

https://www.noemamag.com/a-new-governing-ecosystem-is-evolving/
1•Brajeshwar•25m ago•0 comments

Growing Number of Satellites Will Leave Streaks on Photos from Space Telescopes

https://e360.yale.edu/digest/satellites-orbiting-telescopes-photos
2•Brajeshwar•25m ago•1 comments

What imitating an iconic robot reveals on vocal imitation in parrots&starlings

https://www.nature.com/articles/s41598-025-23444-7
1•bookofjoe•27m ago•0 comments

Carv: Whoop for Skiing

https://getcarv.com
1•danielfalbo•27m ago•0 comments

AI Slop Is Ruining Reddit for Everyone

https://www.wired.com/story/ai-slop-is-ruining-reddit-for-everyone/
4•thm•29m ago•3 comments

Robot Dog Billionaires Take Photos and Poop Them Out

https://petapixel.com/2025/12/05/beeple-robot-dogs-photos-elon-musk-mark-zuckerberg-miami-art-basel/
3•b0ner_t0ner•30m ago•1 comments

Every class I went to during the first week of fall

https://mitadmissions.org/blogs/entry/every-class-i-went-to-during-the-first-week-of-fall/
1•samuel246•37m ago•0 comments

Fast Median Filter over arbitrary datatypes

https://martianlantern.github.io/2025/09/median-filter-over-arbitrary-datatypes/
1•martianlantern•39m ago•0 comments

Artificial intelligence research has a slop problem

https://www.theguardian.com/technology/2025/dec/06/ai-research-papers
1•n1b0m•40m ago•1 comments

Another AI slop story: ChatGPT vs. Human

https://joshua.hu/ai-slop-story-nginx-leaking-dns-chatgpt
3•detaro•40m ago•1 comments

Show HN: Built an all-in-one feedback board for SaaS apps – Ship features

2•rahulbstomar•42m ago•2 comments