daemon-rewrite/mysql: Improve performance (WIP)