Need to improve performance of certain queries that Mysql uses in Mattermost

Description

Summary

There are some queries that take a long time in the database. Maybe they can be improved?

Query :

This query took 52 seconds to run. We do not have any known methods to optimize the query yet, but hopefully it can be improved so it completes faster.

QA Test Steps

None

Mana

None

Assignee

Unassigned

QA Assignee

None

Reporter

Joe Wai Tye

Epic Link

Fix versions

None

Mattermost Team

Platform

Sprint

Labels

None

QA Testing Areas

None

GitHub Issue

None

Components

None
Configure