Divine Comedy

The provided text discusses a problematic stored procedure in MariaDB, documented by a developer named Salagir. This procedure, designed for retrieving translations, is presented as a cautionary tale due to numerous issues. The code is marked as "dead code" but is retained for its historical value and the lessons it offers. Salagir's comment highlights several difficulties encountered, starting with syntax incompatibilities between database environments. A significant hurdle involved a global server setting required for the procedure's execution, which was easily overlooked. The comment also details how incorrect index usage due to data type mismatches led to full table scans. Debugging this procedure was extremely difficult, requiring developers to resort to monitoring database process lists. The most severe problem was the procedure causing unkillable database locks, necessitating complete database recreation. Ultimately, the procedure was replaced by a simpler subquery, resolving all the encountered issues. The author suggests that such a function was an unnecessary complication for a task easily handled by standard database operations.