### Apache Airflow version

2.5.0

### What happened

We're currently running a suboptimal setup where database connectivity is laggy, 125ms roundtrip.

This has interesting consequences. For example, `airflow roles list` is really slow. Turns out that it's doing a lot of individual queries.

### What you think should happen instead

Ideally, listing roles should be a single (perhaps complex) query.

### How to reproduce

We're using py-spy to sample program execution:

```bash
$ py-spy record -o spy.svg -i --rate 250 --nonblocking airflow roles list
```
Now, to see the bad behavior, the database should incur significant latency.

### Operating System

Linux

### Versions of Apache Airflow Providers

_No response_

### Deployment

Official Apache Airflow Helm Chart

### Deployment details

_No response_

### Anything else

_No response_

### Are you willing to submit PR?

- [ ] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)

for name in args.resource:
        resource: Resource | None = asm.get_resource(name)
        if not resource:
            print(f"Resource named '{name}' does not exist")
            exit(1)
    for name in args.action or []:
        action: Action | None = asm.get_action(name)
        if not action:
            print(f"Action named '{name}' does not exist")
            exit(1)
    permission_count = 0
    for (role_name, resource_name, action_name) in list(
        itertools.product(args.role, args.resource, args.action or [None])
    ):
        res_key = (role_name, resource_name)
        if is_add and action_name not in perm_map[res_key]:
            perm: Permission | None = asm.create_permission(action_name, resource_name)
            asm.add_permission_to_role(role_map[role_name], perm)
            print(f"Added {perm} to role {role_name}")
            permission_count += 1
        elif not is_add and res_key in perm_map:
            for _action_name in perm_map[res_key] if action_name is None else [action_name]:
                perm: Permission | None = asm.get_permission(_action_name, resource_name)
                asm.remove_permission_from_role(role_map[role_name], perm)
                print(f"Deleted {perm} from role {role_name}")
                permission_count += 1
    print(f"{'Added' if is_add else 'Deleted'} {permission_count} permission(s)")
@cli_utils.action_cli
@suppress_logs_and_warning
def roles_add_perms(args):