Fetch user_id before doing logging table scan, this helps a lot.