Idempotent query executor