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

Agentic Coding 101 – Structured methodology for AI coding on large repos

https://agenticoding.ai/
1•NadavBenItzhak•19s ago•1 comments

Show HN: Corvus Robotics (YC S18) Inventory drones with full life-cycle autonomy

1•robot_jackie•44s ago•0 comments

Google court filings suggest ChromeOS has an expiration date

https://arstechnica.com/google/2026/02/google-court-filings-suggest-googles-chromeos-has-an-expir...
1•pjmlp•45s ago•0 comments

FlashAttention-T: Towards Tensorized Attention

https://dl.acm.org/doi/10.1145/3774934.3786425
2•matt_d•2m ago•0 comments

Sinofsky to Epstein on Cook and Forstall

https://mjtsai.com/blog/2026/02/03/sinofsky-on-cook-and-forstall/
1•bangonkeyboard•3m ago•0 comments

Scaling GPU-to-CPU Migration for Efficient Distributed Execution on CPU Clusters

https://dl.acm.org/doi/10.1145/3774934.3786435
1•matt_d•3m ago•0 comments

Nintendo Switch is the second-bestselling game console ever, behind only the PS2

https://arstechnica.com/gadgets/2026/02/original-nintendo-switch-passes-the-ds-to-become-nintendo...
1•pjmlp•3m ago•0 comments

Quantum Fiber is now part of the AT&T family

https://privatebin.seattlematrix.org/?ca8e9aea4f427a17#DRk6xTUwk2UrhmUUXwyJA3CKYrhTQCjWxrW3yo5RysRp
1•aendruk•5m ago•1 comments

this is me

https://twitter.com/trq212/status/2018742219424059439
1•tosh•5m ago•0 comments

Diversification Across Time [pdf]

https://ianayres.yale.edu/sites/default/files/files/Diversification%20Across%20T%20ime(1).pdf
1•baxtr•5m ago•0 comments

Stay Away from My Screen

https://github.com/aeilot/stay-away-from-my-screen
1•aeilot•7m ago•0 comments

MetaAttention: A Unified&Performant Attention Framework across Hardware Backends

https://dl.acm.org/doi/10.1145/3774934.3786444
1•matt_d•8m ago•0 comments

Free as in Burned Out: Who Pays for Open Source? [video]

https://fosdem.org/2026/schedule/event/L3BK7S-free-as-in-burned-out/
1•pjmlp•10m ago•0 comments

Documentation is more than you think

https://yanthomas.dev/articles/documentation-is-more-than-you-think/
1•coloneltcb•10m ago•0 comments

Show HN: Scrape (auto-discover APIs or HTML) & Monitor changes on any site

https://github.com/reverse/meter-sdk
1•chadwebscraper•10m ago•0 comments

Good Engineering Managers Don't Leave the Technology Behind

https://www.jacobmarks.com/2026/02/managing-vs-developing-software.html
1•J8K357R•11m ago•0 comments

A Protester, the White House and a Doctored Photo

https://www.nytimes.com/2026/02/03/us/politics/nekima-levy-armstrong-minnesota-protest.html
1•ripe•11m ago•0 comments

Securing Transactions in a Trust-less world

https://bryonyoni.substack.com/p/securing-transactions-in-a-trust
1•bryonyoni•12m ago•0 comments

Information Is Beautiful

https://informationisbeautiful.net/
2•surprisetalk•13m ago•0 comments

Nature Became a 'Prestige' Journal

https://www.asimov.press/p/nature
3•surprisetalk•13m ago•0 comments

Good Old Days: Classic games and more

https://www.goodolddays.net/
3•surprisetalk•13m ago•0 comments

Tractor

https://incoherency.co.uk/blog/stories/tractor.html
1•surprisetalk•13m ago•0 comments

Show HN: Reimplementing PyTorch from scratch (MLP, CNN) to learn the internals

https://github.com/geyuxu/nn-from-scratch
1•geyuxu•14m ago•1 comments

Ask HN: What's your preferred Python tool to convert Markdown to print ready PDF

2•eon01•15m ago•0 comments

A Dilettate's Philosophy of Mind

https://mtmason.com/a-dilettantes-philosophy-of-mind/
1•aerodog•17m ago•0 comments

Trump's UAE Chip Deal Is a National Security Risk

https://www.bloomberg.com/opinion/articles/2026-02-02/trump-s-uae-chip-deal-is-a-national-securit...
3•voxadam•18m ago•1 comments

Iran's Internet Blackout is Unprecedented [video]

https://www.youtube.com/watch?v=3A-efKY-bDw
2•us321•18m ago•2 comments

Ask HN: Is Cursor still working for you?

2•ezulabs•18m ago•0 comments

Does Intermittent Fasting Live Up to the Hype?

https://www.nytimes.com/2026/01/26/well/eat/intermittent-fasting.html
1•doener•23m ago•0 comments

2 days left to comment on DOT's plan to hike US fuel costs by $23B

https://electrek.co/2026/02/02/2-days-left-to-comment-on-dots-plan-to-hike-us-fuel-costs-by-23b/
2•Bender•25m ago•0 comments