r/shittyprogramming • u/calsosta • Nov 30 '18
Friday Code Confessions
If you have been living with technical debt and want absolution here is your opportunity.
Confess your sins and receive your penance.
155
Upvotes
View all comments
Show parent comment
3
u/[deleted] Dec 01 '18
Oh god I found a batch update function that would take a series of items, enter a loop with them, ask the database to store them, one by one, and then ... commit ... one by one.
It took 30 fucking minutes to save a few hundred rows. I moved the commit out of the loop and all of a sudden a lot of things were about an order of magnitude faster, with the added benefit that a botched batch of rows didn't break everything, because there wasn't a ton of shit to clean up.