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?

Ask HN: How do you keep up with replies to your posts/comments?

2•alcazar•43s ago•0 comments

AgentBPF: eBPF-based observability for LLM agent trajectories

https://github.com/pandyamarut/AgentBPF
2•mwiki•1m ago•0 comments

Google says it will let UK publishers opt out of AI overviews

https://www.theregister.com/2026/03/19/google_opts_for_optout_on/
1•bundie•1m ago•0 comments

Ask HN: Is Google disabling accounts for using gws CLI with OpenClaw?

1•anandvc•2m ago•0 comments

Show HN: JobsByCulture – Find jobs where you'll enjoy working

https://jobsbyculture.com
1•saipradeep77•4m ago•0 comments

Show HN: Pocodex – Remote Control for Codex

https://github.com/davej/pocodex
1•davej•7m ago•0 comments

Cuba Is Going Dark

https://www.nytimes.com/interactive/2026/03/19/world/americas/cuba-blackout-electricity.html
2•saikatsg•7m ago•0 comments

Five more seated Gauls found in Dijon

https://www.thehistoryblog.com/archives/75639
1•speckx•7m ago•0 comments

Twin prime ramadan: crypto is borked

https://conferenceofthebirds.tiiny.site/
1•shaunxcode•9m ago•0 comments

Show HN: New hard science fiction novel

1•dufbugderopa•10m ago•1 comments

Not so diplomatic: Witkoff, Kushner, and Trump's march to war in Iran

https://responsiblestatecraft.org/witkoff-iran-war/
1•jamesgill•10m ago•1 comments

The ideological orientation of academic social science research 1960–2024

https://link.springer.com/article/10.1007/s11186-026-09690-2
1•bko•10m ago•1 comments

Video Effect Vibe – AI Motion Graphics in Seconds

https://videoeffectvibe.com
1•bruuuuuuuuh•11m ago•0 comments

Connecticut and the 1 Kilometer Effect

https://alearningaday.blog/2026/03/19/connecticut-and-the-1-kilometer-effect/
2•speckx•12m ago•0 comments

Restarting Fieldwide Shutdown for Middle East Oil and Gas Producers Is Not Easy

https://cyrusashayeri.substack.com/p/restarting-fieldwide-shutdown-for
2•toomuchtodo•12m ago•0 comments

Chrome endorsed READR organically in 16 days The algorithm made its verdict

https://wushu75.github.io/readr/
1•Ogbon•12m ago•0 comments

Ask HN: What do you think about Claude going down every day now?

1•scratchyone•15m ago•3 comments

Google details new 24-hour process to sideload unverified Android apps

https://arstechnica.com/gadgets/2026/03/google-details-new-24-hour-process-to-sideload-unverified...
2•MBCook•15m ago•0 comments

Why lab coats are white

https://www.asimov.press/p/lab-coat
1•bookofjoe•15m ago•0 comments

The fiery, deadly crashes involving the Tesla Cybertruck

https://www.theguardian.com/technology/2026/mar/18/tesla-cybertruck-crashes-battery-fires
4•fmihaila•16m ago•0 comments

US has "lost control of its own foreign policy", Oman says

https://www.theguardian.com/world/2026/mar/19/us-lost-control-of-its-own-foreign-policy-oman-fore...
28•prmph•16m ago•2 comments

A private space company has a new plan to bag an asteroid

https://arstechnica.com/space/2026/03/a-private-space-company-has-a-radical-new-plan-to-bag-an-as...
1•cryptoz•17m ago•0 comments

Claude Drexler

https://claudedrexler.com/
1•mattdionis•18m ago•0 comments

San Francisco's DNA is mischief

https://www.fieldnotes.nautilus.quest/p/san-franciscos-dna-is-mischief
3•zackoverflow•22m ago•1 comments

How the first electric grid was built

https://worksinprogress.co/issue/how-the-worlds-first-electric-grid-was-built/
2•deunamuno•22m ago•0 comments

Google announces Firebase Studio sunset and project migration

https://firebase.google.com/docs/studio/migrating-project
4•tmoertel•23m ago•0 comments

I Think a New Role Is Emerging in Tech

https://newsletter.thelongcommit.com/p/i-think-a-new-role-is-emerging-in
2•jcmartinezdev•24m ago•0 comments

Budgetbreeze – an AI centric personal finance tool

https://www.budgetbreeze.io/
1•boxstream•24m ago•1 comments

Imagined Unrealities

https://zuhayeer.com/writing/imagined-unrealities.html
1•zuhayeer•24m ago•0 comments

Why $4 gasoline is the tipping point for EVs

https://grist.org/energy/why-4-gasoline-is-the-tipping-point-for-evs/
1•speckx•24m ago•1 comments