I've seen many different systems and made many different mistakes in my career. But the root of a bill I recently paid, in my opinion, stemmed from my excessive trust in "artificial intelligence"-written code. A seemingly minor optimization effort in a manufacturing ERP led to a months-long, hidden performance degradation.
Paying the bill for AI-written code was much more painful than I expected. Initially, everything seemed fine; in fact, the problem appeared to be solved. But the real cost hit the system where I least expected it. This story might not have shaken my belief in the power of AI, but it reminded me once again that I must always remain pragmatic.
The Initial Spark: AI-Written Code and the Illusion of a Quick Fix
In a manufacturing ERP, especially while developing the AI-powered production planning module, certain background tasks needed optimization. Periodically cleaning specific tables and performing index maintenance in the database were critical. To make these processes more robust, I decided to use a systemd timer. It was a simple task, but with the pressure of speed at the time, I thought, "why not ask AI?"
AI suggested a systemd unit and timer combination that seemed quite logical to me. It ran a Python script with a simple ExecStart command, and the script, in turn, triggered pg_repack and VACUUM ANALYZE operations at regular intervals. The script creating its own waiting loop with an expression like sleep 360 seemed flexible and controllable to me at the time. "Why restart from scratch and consume resources every time?" I thought.






