MM-28815: Message export query optimization. (#15757)

* MM-28815: Optimizes message export query.

* MM-28815: Removes DeleteAt WHERE condition.

* MM-28815: Adds Id to the ORDER BY clause.

* MM-28815: Concatenates the string to remove the confusing '%%' in the query.

* MM-28115: Remvoes secondary sorting.

* MM-28815: Keeps the alias in the order by.

* MM-28815: Removing forced index.

* MM-28815: Formatting.
Этот коммит содержится в:
Martin Kraft
2020-10-16 10:21:36 -04:00
коммит произвёл GitHub
родитель 4b57cea789
Коммит d519ab580f

Просмотреть файл

@@ -220,7 +220,6 @@ func (s SqlComplianceStore) MessageExport(after int64, limit int) ([]*model.Mess
Posts.Props AS PostProps,
Posts.OriginalId AS PostOriginalId,
Posts.RootId AS PostRootId,
Posts.Props AS PostProps,
Posts.FileIds AS PostFileIds,
Teams.Id AS TeamId,
Teams.Name AS TeamName,
@@ -244,7 +243,7 @@ func (s SqlComplianceStore) MessageExport(after int64, limit int) ([]*model.Mess
LEFT OUTER JOIN Users ON Posts.UserId = Users.Id
LEFT JOIN Bots ON Bots.UserId = Posts.UserId
WHERE
(Posts.CreateAt > :StartTime OR Posts.UpdateAt > :StartTime OR Posts.DeleteAt > :StartTime) AND
Posts.UpdateAt > :StartTime AND
Posts.Type NOT LIKE 'system_%'
ORDER BY PostUpdateAt
LIMIT :Limit`