Gives me the data before, the data after (so I can see the changes I've made), and I'll also check the changed rows in case I've been dumb and forgot to account for triggers, and make sure those are all correct.
If I'm happy that the result has done what I want, commit. If I'm unhappy, rollback and rework my statements
In my experience, and there's a bunch of it, the times you'll be manually executing a DELETE are (or should be) only slightly above zero.
So while you think my DELETE is "pretty inefficient" because I wrote it to fully express my intent, it's actually not inefficient at all, as its efficacy is determined by "Can other people understand my intent", not how fast it deletes data.
If I want or need fast deletion of data, then I'm going to use partitioning and truncate entire partitions at a time - you're focused on the micro, not the macro.
If you need to worry about the performance of your DELETEs, you need to worry about your entire approach to data engineering mate, as efficient data removal doesn't use DELETEs.
I've worked at places where we never deleted anything, for any reason, and instead just set a soft_delete flag on the row so that the system would treat it as deleted. This isn't GDPR compliant, though.
View all comments
2.2k
u/Ghostserver10 Oct 14 '25
I usually never type delete or update. Select first, see what you're about to change only then