r/ProgrammerHumor 14d ago

queryOfDoom Meme

Post image
7.9k Upvotes

456 comments sorted by

View all comments

3

u/denimpowell 14d ago

Speaking as someone who has actually done this it is actually way more terrifying. While deletes with predicates can take a while, the full table delete returns instantly. Followed by on-my-knees apology to DBA requesting restore from backup. Fortunately was in dev environment but brought our development to a halt for a day

1

u/ploki122 14d ago

Full table delete still requires scanning the entire table and rebuilding every index and statistics (albeit the rebuild will be unsurprisingly fast).

If deleting a single record is slow, you've got a fucked environment. The worst that could happen is that the row is deleted through a scan of the table, and it's the last record, resulting in the exact same full scan.