optimize query log