I recently upgraded my Mattermost server from version 5.31.0 to 7.9.1, and I noticed that the API endpoint “Get channel statistics” has become significantly slower, taking 20 times longer than before:
In v5.31.0: 77 ms with 565 B of response size
In v7.9.1: 1525 ms with 525 B of response size
I’m wondering if there are any possible solutions to fix this performance issue?
That’s not a log, but you would need to be connected to your PostgreSQL instance and run the following query after you’ve started the API call:
select pid,backend_start,query_start,state_change,waiting,state,query from pg_stat_activity;
this will show you a list of currently running queries, maybe one of them is slow - you can run the queries on the command line then to see which one of them is the slow one.
Alright, nice finding - the file count is obviously new here and requires querying additional tables which results in longer execution times. Good to hear that by restoring the previous behaviour you’re able to achieve the same speeds again.
I know it can be done in the api, but I want to attach this parameter to the request sent by the client. Is there any setting options such as the system console?