Open muety opened 3 years ago
Best chance would be to compute the metrics once and from then on count changes, i.e. incrementing or decrementing the counters on a per-request basis. However, this would be way too much effort for optimizing a maintenance endpoint only.
This query is quite expensive, but I can't think of a way to make it any more efficient.
Maybe at least attempt to get rid of these preloads here, which each result in a separate index range scan query.
According to the recently introduced Sentry performance monitoring, half of all requests to the
/metrics
endpoint currently take around five seconds. The endpoint involves multiple full-tableCOUNT(*)
queries. But we still might be able to optimize here.