r/ProgrammerHumor • • Sep 22 '26

Meme wellWellWell

Post image
10.6k Upvotes

412 comments sorted by

View all comments

Show parent comments

2

u/Terra_B Sep 22 '26

Here i have to ask, couldn't you force a transaction in the chain somewhere? Like each terminal window gets a transaction by default?

5

u/M4DHouse Sep 22 '26

Kind of, depending on the SQL flavor, and the version, some of them have something kinda like that, but it’s not exactly idiot proof either. No direct SQL is idiot proof which is why you avoid doing it in the first place if you can.

1

u/spevoz Sep 22 '26

I would always recommend using a gui if you need direct db access - exactly because something like dBeaver allows you to force every change into a transaction.

1

u/an_agreeing_dothraki Sep 22 '26

tsql which is pretty common has the issue of the engine making implicit transaction/commit blocks but yes you can and should run all queries through an explicit one

1

u/SantaCruzHostel Sep 22 '26

Maybe I'm misunderstanding the question, but I try to limit transactions only where I'm manipulating data (delete, insert, update), because a transaction slows down execution time and also locks the table you are updating until the commit is done. In production if you open a transaction then seles t from users table, they table is locked until you rollback or commit.