The way pending subscriptions requests were fetched by the REST API server was very slow. It would iterate over all the pendables, fetche they key-values, and filter on that in Python.
This MR adds a 'find()' method with specific queries that can filter on a mailing list and on a request type in SQL. It also adds a few database indexes on columns that can be subject of an SQL filter.
The biggest API change is that all Pendables are requested to have a type key, but it is an internal API so it shouldn't be a problem.
The measured speed improvement is 120x, going from 18 minutes to 9 seconds on a large installation.