Optimising last N attacks query.