faster cleanup query