Fix Database memory consumption with MySQL/MariaDB
Optimize memory allocation during file writing operations