Optimize AnalyticsPostCount (#20727)
We use * instead of a column name to use index-only scan always even when other column filters are applied. Right now, index-only scan will only get applied in the basic query of "select count(p.id) as value from posts p". But it won't get applied if the query is "select count(p.id) as value from posts p where p.deleteat=0". So this is a minor optimization which improves some corner cases. This was found from the slow query monitoring. ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
ee41162b48
Коммит
334b199e7a
@@ -2195,7 +2195,7 @@ func (s *SqlPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCoun
|
||||
|
||||
func (s *SqlPostStore) AnalyticsPostCount(options *model.PostCountOptions) (int64, error) {
|
||||
query := s.getQueryBuilder().
|
||||
Select("COUNT(p.Id) AS Value").
|
||||
Select("COUNT(*) AS Value").
|
||||
From("Posts p")
|
||||
|
||||
if options.TeamId != "" {
|
||||
|
||||
Ссылка в новой задаче
Block a user