Isn't `ORDER BY commit_id DESC, fl.id DESC` sufficient to get max file_links id?