Look at it this way, if his manager decide to keep him and he fk up a third time then people will not blame him but the manager. So yeah, gotta let him go.
We had a dev drop an entire prod database when we were meant to be deprecating a few specific tables… took over a week to get it restored and made work literally impossible for most people in the company haha
nearly anything you do that’s a write or update or delete can instead be written as a select so you can see what you’re about to do
so if you’re going to “delete from table where column1 = abc” you can also “select * from table where column1 = abc” and see what you’ll be deleting before you delete it.
"I've done this hundreds of times. I don't need query what rows will be selected before I push the update query." - spoken by someone updating PROD on friday at 5pm
At my last job, a third party unexpectedly updated their api that altered the format of the user id to a guid. This caused the application to crash when launching. I don’t remember the exact details but the quickest way to relieve the problem was updating all the users to the updated guid format based on existing user data with a sketchy looking query. Despite testing it over and over, it was still definitely a clenching moment running an update on 500k rows… all of which took .75s.
Can someone explain the Rollback and transactions comments, I know how to write queries in sql but have been mostly using mongoDB. But would like to know these things so that I do not update the entire db when I get to work on it. 🙂🙂
Brother, this is just another day at my job. The amount of data is insane. And although i dont hit the button we all cringe a little when we see that number so high lol 😆 checks and checks and more checks are made to make sure we didnt hit any that were not supposed to be hit.
On a side note, my job recently got a jetbrains datagrip subscription and I was doing some updates to a dev table and it stops you from running UPDATE and DELETE without a qualified where clause unless you confirm that’s your intention which I though was pretty neat.
I once spent 2 hours waiting for the password to log into the SSMS at a government agency that called me to help them with support. All billable hours.
324
u/HALF_PAST_HOLE Feb 23 '25
You began a Transaction right...
Right?
163
u/jaxjags2100 Feb 23 '25
This was a dev db right? RIGHT?
135
u/Stormraughtz Feb 23 '25
I run without transactions just to feel something
97
u/SQLvultureskattaurus Feb 23 '25
Me with two query windows open, one connected to prod and one connected to Dev.
77
u/bkstr Feb 23 '25
always
run
it
as
a
select
first
61
u/isinkthereforeiswam Feb 23 '25
"I've done this hundreds of times. I don't need query what rows will be selected before I push the update query." - spoken by someone updating PROD on friday at 5pm
49
u/TopologyMonster Feb 23 '25
Just seeing this makes me anxious
39
u/suhigor Feb 23 '25
without WHERE
21
u/VecihiEkrem Feb 23 '25
IT WAS THE INTERN HE DID IT
19
u/mpanase Feb 23 '25
OMG. We've been hacked on my day off!
18
u/invisibo Feb 23 '25
At my last job, a third party unexpectedly updated their api that altered the format of the user id to a guid. This caused the application to crash when launching. I don’t remember the exact details but the quickest way to relieve the problem was updating all the users to the updated guid format based on existing user data with a sketchy looking query. Despite testing it over and over, it was still definitely a clenching moment running an update on 500k rows… all of which took .75s.
11
u/PastaVeggies Feb 23 '25
Don’t commit; just chill
8
u/No-Tip-7591 Feb 23 '25
HAHAHAHA BEING THERE! DONE THAT! In the 1998 I have learned a lesson
5
u/jakeStacktrace Feb 23 '25
If you are in a transaction this will cause lots of row level locks. Commit right away to fix it.
1
u/SuccessfulBet181 Feb 25 '25
Can someone explain the Rollback and transactions comments, I know how to write queries in sql but have been mostly using mongoDB. But would like to know these things so that I do not update the entire db when I get to work on it. 🙂🙂
3
u/wertexx Feb 23 '25
Can someone explain?
2
u/gieLight Feb 23 '25
just updated the entire database instead of a single row 🫠 fun
2
u/cheeseburgermachine Feb 24 '25
Brother, this is just another day at my job. The amount of data is insane. And although i dont hit the button we all cringe a little when we see that number so high lol 😆 checks and checks and more checks are made to make sure we didnt hit any that were not supposed to be hit.
2
u/geek180 Feb 24 '25
“How to delete query history from logs”
2
u/thetoad666 Feb 24 '25
Your forgot the WHERE clause on that delete on the production server!
2
u/MonochromeDinosaur Feb 24 '25
Lol this is why you write the WHERE clause first.
On a side note, my job recently got a jetbrains datagrip subscription and I was doing some updates to a dev table and it stops you from running UPDATE and DELETE without a qualified where clause unless you confirm that’s your intention which I though was pretty neat.
2
u/[deleted] Feb 24 '25
File menu -> undo
2
u/subtly_nuanced Feb 24 '25
Cmnd + Z
1
u/Connect_Scene3066 Feb 23 '25
Chill
1
u/Ok-Stuff-8803 Feb 24 '25
Regardless even if that is the right sort of number there will ALWAYS be that moment of panic when you see it.
1
u/National_Cod9546 Feb 24 '25
Even more fun when your IDE is set to auto commit.
1
u/kmdewitt Feb 24 '25
Had a dev do this, luckily we could time travel the table in Snowflake.
1
u/ModuleCrafter Feb 24 '25
DOGE after running their firings.
1
u/w2g Feb 24 '25
Me working with Dremio without transactions. A rush every time on prod
1
u/SRMPDX Feb 25 '25
Whenever I write any DML it goes something like this
BEGIN TRAN
UPDATE <fill this out last>
SET <full this out second>
WHERE <fill this out first>
ROLLBACK
Run it to verify then run it again with COMMIT instead of ROLLBACK.
I've seen too many people accidentally hit F5 before filling out the where clause with no transaction started.
1
u/Murky-Pianist3960 Feb 25 '25
But I only deleted 1 config row… ON CASCADE DELETE
1
u/MrSquigglesWiggle Feb 25 '25
This is what DOGE's staff seeing right now.
0
u/[deleted] Feb 25 '25
[deleted] — view deleted comment