this post was submitted on 06 Nov 2023
1315 points (98.7% liked)

Programmer Humor

32197 readers
74 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] SzethFriendOfNimi@lemmy.world 13 points 11 months ago* (last edited 11 months ago) (2 children)

Transactions are your friend here

Begin transaction;

Then

Your sql here

Double/triple check the messages/console for results. Look good?

Commit;

Worried?

Rollback;

Just be sure to mind your transaction logs for long running queries and by all things holy be sure you’re not doing this to a live db with a ton of transactions since you’re basically pausing any updates until the commit or rollback on the affected tables

[–] xmunk@sh.itjust.works 16 points 11 months ago* (last edited 11 months ago) (1 children)

This makes it safer but like... don't run queries on production outside emergencies ever.

That transaction frame, depending on your specific DB, may cause severe performance side effects.

Look, the safe approach is to write it into something, PR it, get it reviewed, and then run it as part of a structured deployment process.

[–] SzethFriendOfNimi@lemmy.world 2 points 11 months ago

Absolutely. It should have been tested and verified.

[–] JoMiran@lemmy.ml 5 points 11 months ago

Me: "Ok. What's the big deal."

Also me: "Less than a million affected. That's nothing."

Still me: "Rule 1: Never let pesky details get in the way of a funny meme."

Ultimately me: 😱😂 "That guy is in for a rough Monday!"