### 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)

"""
        This method is useful if you have changed
        the name of your menus or classes,
        changing them will leave behind permissions
        that are not associated with anything.
        You can use it always or just sometimes to
        perform a security cleanup. Warning this will delete any permission
        that is no longer part of any registered view or menu.
        Remember invoke ONLY AFTER YOU HAVE REGISTERED ALL VIEWS
        """
        self.sm.security_cleanup(self.baseviews, self.menu)
    def security_converge(self, dry=False) -> dict:
        """
            This method is useful when you use:
            - `class_permission_name`
            - `previous_class_permission_name`
            - `method_permission_name`
            - `previous_method_permission_name`
            migrates all permissions to the new names on all the Roles
        :param dry: If True will not change DB
        :return: Dict with all computed necessary operations
        """
        return self.sm.security_converge(self.baseviews, self.menu, dry)
    @property
    def get_url_for_login(self):