frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Ask HN: Running UPDATEs in production always feels heavier than it should

3•Lucy_Bai•6h ago
I’m curious how many of you have felt this:

You’re in production. The change is “simple”. A small UPDATE or DELETE with a WHERE clause you’ve read over multiple times.

Still, right before hitting enter, there’s that pause.

Not because you don’t know SQL. Not because you didn’t think it through. But because you know: •If this goes wrong, it’s on you •Rollback isn’t always clean or instant •And the safest option is often… “don’t touch it”

In reality, I’ve seen people deal with this by: •Manually backing up data “just in case” •Having someone else stare at the query with them •Restricting who’s allowed to run anything at all •Or simply avoiding fixing things directly in prod

I’m not asking for best practices or tooling advice.

I’m genuinely curious:

What do you personally do, when you have to change data and can’t be 100% sure it’s harmless?

Is this just an unavoidable part of working with production databases?

Comments

necovek•5h ago
I apply "better practices and tooling", advice you are not looking for ;)
pestatije•4h ago
yeah definitely don't ever touch production like that, use best practices, and tooling

my 2c

scrapheap•3h ago
That fear is good, it means you know that you're taking a risk - I'd worry if you had to touch production and didn't feel that fear.

If you only have the one or two production systems/databases, and you're having to do this more than a couple of times each year, then you could certainly benefit for improving your tooling.

But if you've inherited a large number of production systems, each with their own local database instance. Then implementing new tooling will be a long process that you might not be able to get Management to agree to.

When I have to touch a production database, I usually use the following steps:

0. Follow your organisation's Change Processes (i.e. if you need to put in a change request and get approval then do that)

1. Snapshot the server itself (VMs are great for this)

2. Backup the database (just be careful not to leave that backup anywhere open, and remember to clear it up when you no longer need it)

3. Write the SELECT version of your SQL first (If you need to delete a record from the userSessions table with an ID of 123, then start by writing

  SELECT * FROM userSessions WHERE id=123;
4. If that shows you just the rows you'd expect then convert it to the delete from of the SQL (making sure that you don't change any part of the WHERE clause)

  DELETE FROM userSessions WHERE id=123;
5. Get someone else, who also understands the database, to check your SQL

6. Run your SQL

7. Do all your sanity checks to make sure that production is working as expected.

8. If it does go wrong then you have more ammunition to use when trying to convince Management to spend some resources on improving your tooling for these sort of changes.

Tell HN: I cut Claude API costs from $70/month to pennies

32•ok_orco•11h ago•14 comments

Ask HN: DDD was a great debugger – what would a modern equivalent look like?

40•manux81•13h ago•40 comments

Ask HN: What software / applications can you now build thanks to AI

5•zarathustra333•7h ago•1 comments

Ask HN: Gmail spam filtering suddenly marking everything as spam?

208•goopthink•1d ago•122 comments

Ask HN: Freelance Qt C++

2•shchess•6h ago•1 comments

Ask HN: Running UPDATEs in production always feels heavier than it should

3•Lucy_Bai•6h ago•3 comments

Ask HN: What's the current best local/open speech-to-speech setup?

253•dsrtslnd23•3d ago•61 comments

Ask HN: Do you have any evidence that agentic coding works?

456•terabytest•5d ago•452 comments

Compiled Node.js 18 from source on jailbroken iPhone to run Claude Code

2•BryanTheCynic•9h ago•0 comments

Ask HN: Some great launch videos in recent times?

2•nemath•10h ago•0 comments

Ask HN: What are the most significant man-made creations to date?

15•George97•22h ago•23 comments

Tell HN: 2 years building a kids audio app as a solo dev – lessons learned

136•oliverjanssen•4d ago•79 comments

SHDL – A Minimal Hardware Description Language Built from Logic Gates

2•rafa_rrayes•11h ago•1 comments

I'm posting this from a memory safe web browser

38•pizlonator•15h ago•2 comments

Ask HN: Why is cursor / Claude Code is so bad at generating readmes?

4•yakshithk_•10h ago•3 comments

Ask HN: Why are so many rolling out their own AI/LLM agent sandboxing solution?

32•ATechGuy•5d ago•14 comments

Ask HN: Have we confused efficiency with "100% utilization"?

27•nickevante•1d ago•20 comments

Ask HN: What usually happens after a VC asks for a demo?

12•stijo•1d ago•6 comments

Ask HN: May an agent accept a license to produce a build?

26•athrowaway3z•1d ago•48 comments

Ask HN: How to reach out to a commenter under an old submission (nick_m)?

4•jsumn•22h ago•4 comments

Ask HN: Revive a mostly dead Discord server

21•movedx•5d ago•29 comments

Ask HN: Career transition question – assistance, MLOps guidance

4•Pierre_Esteves•1d ago•0 comments

Ask HN: Why does the number of datasets on data.gov vary so much?

8•akudha•1d ago•4 comments

Ask HN: Thinking about memory for AI coding agents

7•hoangnnguyen•2d ago•9 comments

Ask HN: What are some good unintuitive statistics problems?

6•ronbenton•1d ago•7 comments

Ask HN: Rust and AI builders interested in local-first, multi-agent systems?

3•cajazzer•1d ago•8 comments

Ask HN: Which common map projections make Greenland look smaller?

19•jimnotgym•5d ago•17 comments

Ask HN: How to redeem a gift card without risking lock-out?

6•magnetic•1d ago•6 comments

Ask HN: Weekend Social: Top two programming languages and what they can borrow?

3•susam•1d ago•7 comments

Ask HN: Do you "micro-manage" your agents?

7•xinbenlv•2d ago•8 comments