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?

Mongolian Script

https://en.wikipedia.org/wiki/Mongolian_script
1•Razengan•2m ago•0 comments

The Impossible Prompt That's Easy for Humans

https://teodordyakov.github.io/the-impossible-promt/
1•ssdsa•8m ago•0 comments

Why GitHub's War on Toasts Is Bad News for Accessibility

https://medium.com/offmessageorg/why-githubs-war-on-toasts-is-bad-news-for-accessibility-a88ddbad...
2•bochoh•9m ago•0 comments

Beijing's prison silences Chinese journalist and lawyer of Covid19 in Wuhan fame

https://www.bushcenter.org/publications/the-struggle-for-freedom-beijings-revolving-prison-doors-...
1•737min•10m ago•0 comments

Show HN: MCP for finding the better NPM dependencies

https://web-production-0200a.up.railway.app
1•jsafaiyeh•13m ago•0 comments

Show HN: Native macOS timeout (Rust) – handles system sleep, no coreutils

https://github.com/denispol/darwin-timeout
1•denispol•16m ago•0 comments

Show HN: TimeProof – Timelapse your computer based workday! (MacOS)

https://apps.apple.com/us/app/timeproof/id6751671026?mt=12
1•Viper117•17m ago•1 comments

Infosys co-founder once again calls for longer than 70-hour weeks – and no, he's

https://www.techradar.com/pro/infosys-co-founder-once-again-calls-for-longer-than-70-hour-weeks-a...
4•sys_64738•19m ago•0 comments

Tesla struggles to course correct from sales skid

https://www.reuters.com/business/autos-transportation/tesla-struggles-course-correct-sales-skid-2...
3•breve•22m ago•0 comments

Show HN: Watsn.ai – Bullshit Detector

https://watsn.ai/
1•flx1012•24m ago•0 comments

Walrus: Distributed message queue written in Rust

1•peterjkl•26m ago•1 comments

How Workplace Fashion Has Changed over the Decades

https://www.wsj.com/style/fashion/office-attire-changes-history-e6e9147b
1•fortran77•27m ago•1 comments

Show HN: GitHub Activity Analytics Powered by ClickHouse

https://velocity.clickhouse.com/#org=ClickHouse&metric=all_activity&range=all&grouping=auto&alexe...
1•saisrirampur•35m ago•1 comments

AI satisfies formal structural subjectivity in the S₀ protocol

https://github.com/jengbeng/ai-structural-subject
1•jengbeng•35m ago•1 comments

Google CEO Pushes 'Vibe Coding' – But Real Developers Know It's Not Magic

https://www.interviewquery.com/p/ai-coding-vibe-coding-explained
2•birdculture•36m ago•0 comments

OBR calls in cyber expert over botched release of Budget analysis

https://www.bbc.com/news/articles/cgmn991pz9jo
1•CharlesW•36m ago•0 comments

Indus River – Scientists may have solved why this ancient civilization vanished

https://www.washingtonpost.com/climate-environment/2025/11/27/indus-river-valley-civilization-cli...
1•pseudolus•39m ago•1 comments

Manus 1.5 Uses TiDB X to Let Agents Ship Full-Stack Apps at Scale

https://www.pingcap.com/blog/how-manus-1-5-uses-tidb-x-to-let-agents-ship-full-stack-apps-at-scale/
3•ngaut•40m ago•0 comments

Is There an AI Bubble?

https://www.deeplearning.ai/the-batch/issue-329/
2•gmays•50m ago•1 comments

Gray wolf reeled in a crab trap with a rope

https://www.popsci.com/environment/wolf-uses-tool-video/
1•geox•52m ago•0 comments

Rope science, part 11 – practical syntax highlighting (2017)

https://xi-editor.io/docs/rope_science_11.html
2•todsacerdoti•53m ago•0 comments

Ask HN: White Label Chat Apps?

1•stonedge•55m ago•1 comments

A triangle whose interior angles sum to zero

https://www.johndcook.com/blog/2025/11/28/tricusp-triangle/
17•tzury•1h ago•7 comments

Virtual MCP Servers: A Use Case-Driven Solution to Tool Overload

https://www.pulsemcp.com/posts/virtual-mcp-servers-and-gateways
1•jngiam1•1h ago•0 comments

What a federal ban on THC-infused drinks and snacks could mean for hemp industry

https://apnews.com/article/hemp-thc-drinks-ban-law-8d77842cb250291a178db6f9d39f8b7e
4•petethomas•1h ago•0 comments

Show HN: Free PPT generator after NotebookLM removed the feature

https://ppt.gbase.ai
1•jinfeng79•1h ago•1 comments

Show HN: Sourcewizard – A wizard for generating integration specs

https://github.com/sourcewizard-ai/sourcewizard/tree/main/apps/planner-ui
3•mifydev•1h ago•8 comments

Air pollution may reduce health benefits of exercise

https://www.ucl.ac.uk/news/2025/nov/air-pollution-may-reduce-health-benefits-exercise
2•hhs•1h ago•0 comments

Investigating a Possible Scammer in Journalism's AI Era

https://thelocal.to/investigating-scam-journalism-ai/
2•jaredwiener•1h ago•0 comments

You Need More Lux (2023)

https://meaningness.com/sad-light-led-lux
1•turtleyacht•1h ago•0 comments