Better query debug logging.