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

What do people love about Rust?

https://blog.rust-lang.org/2025/12/19/what-do-people-love-about-rust/
1•todsacerdoti•1m ago•0 comments

Anthropic says AI sentiment is positive. Their data tells a different story

https://www.playbookatlas.com/research/ai-adoption-explorer
1•jp8585•2m ago•1 comments

Notable Book Covers of 2025

https://www.casualoptimist.com/blog/2025/12/10/notable-book-covers-of-2025/
2•zdw•4m ago•0 comments

Why You Should Never Again Utter The Word, “CIFS” (2012)

https://blog.fosketts.net/2012/02/16/cifs-smb/
1•sipofwater•7m ago•1 comments

Growth of renewable energy is Science's 2025 Breakthrough of the Year

https://www.science.org/content/article/breakthrough-2025
2•g8oz•8m ago•0 comments

Epstein Files Released by DOJ

https://www.cnbc.com/2025/12/19/jeffrey-epstein-files-doj-release-order-maxwell.html
2•donsupreme•8m ago•1 comments

Transition of Adobe eBook Platform to Harman

https://helpx.adobe.com/enterprise/kb/eol-faq-adobe-digital-editions.html
1•tech234a•12m ago•0 comments

Shriram Krishnamurthi's Pedagogy Recommendations

https://parentheticallyspeaking.org/articles/pedagogy-recommendations/
1•azhenley•12m ago•0 comments

Epstein

https://www.justice.gov/queue/view?c=usdoj&e=usdojsearch&ver=javascript-5.0.1&cver=11&man=www.jus...
2•dboreham•13m ago•1 comments

Trust the Process

https://thinkhuman.com/trust-the-process/
2•jamesgill•13m ago•0 comments

Trending Django Projects in 2025

https://django.wtf/trending/?trending=365
1•reowii•13m ago•0 comments

EB1 visa gives some hope after H1B changes

https://www.geteb1.us/
2•gauze•14m ago•0 comments

Pound – Light-weight reverse proxy, load balancer and HTTPS front-end

https://github.com/graygnuorg/pound
2•smartmic•14m ago•0 comments

Show HN: Merview – OSS Mermaid and Markdown Editor and Viewer

https://merview.com
1•mickdarling•14m ago•0 comments

Ceratizit Agrees to Pay $54M to Settle Evaded Customs on PRC Tungsten Carbide

https://www.justice.gov/usao-edmi/pr/ceratizit-usa-llc-agrees-pay-544m-settle-false-claims-act-al...
1•737min•15m ago•0 comments

Show HN: ScreenCaptureKit-rs – Safe Rust bindings for macOS screen capture

https://github.com/doom-fish/screencapturekit-rs
1•doomfish•16m ago•0 comments

Stanford computer science grads find their degrees no longer guarantee jobs

https://www.latimes.com/business/story/2025-12-19/they-graduated-from-stanford-due-to-ai-they-can...
3•bookofjoe•16m ago•2 comments

How to have polygenically screened children using IVF

https://www.lesswrong.com/posts/yT22RcWrxZcXyGjsA/how-to-have-polygenically-screened-children
2•jelsisi•16m ago•0 comments

Why do companies register private TLDs but never use them? (2024)

https://old.reddit.com/r/webdev/comments/1ialsut/why_do_companies_register_private_tlds_but_never/
1•petethomas•18m ago•0 comments

Business Model Innovation: Concierge heat pump companies make it easy

https://www.heatpumped.org/p/business-model-innovation
1•ssuds•19m ago•0 comments

Unix V4 tape from University of Utah (raw)

https://archive.org/details/utah_unix_v4_raw
2•vitplister•20m ago•0 comments

The VC Roll-Up Craze That Has Taken Silicon Valley by Storm

https://www.newcomer.co/p/inside-the-vc-roll-up-craze-that
1•gmays•22m ago•0 comments

Who is shaping the future of AI?

https://www.npr.org/2025/12/19/nx-s1-5648239/who-is-really-shaping-the-future-of-ai
1•gmays•27m ago•0 comments

Musk wins appeal that restores 2018 Tesla pay deal now worth about $155B

https://www.reuters.com/sustainability/boards-policy-regulation/musk-wins-appeal-restores-2018-te...
3•granzymes•30m ago•0 comments

NYPost Coverage of Epstein Release

https://nypost.com/2025/12/19/us-news/epstein-files-photos-release-live-updates-from-documents-di...
4•almosthere•32m ago•3 comments

Sequoia's Shaun Maguire accused an innocent Palestinian of being Brown shooter

https://www.fastcompany.com/91463942/sequoia-shaun-maguire-brown-university-shooter-palestine
6•Aliabid94•32m ago•0 comments

Ask HN: If it were to be sold, how much would HN cost?

1•01-_-•36m ago•11 comments

CSS Grid Lanes

https://webkit.org/blog/17660/introducing-css-grid-lanes/
54•frizlab•37m ago•2 comments

A List of Books to Learn Programming with Ruby and Rails (2023)

https://www.writesoftwarewell.com/books-to-learn-ruby-and-rails/
1•todsacerdoti•37m ago•0 comments

When Your Private Fund Turns $1 into 60 Cents

https://www.wsj.com/finance/investing/when-your-private-fund-turns-1-into-60-cents-445d63c2
2•petethomas•39m ago•0 comments