🐛 [Bug] Sort by "most commented" or "most popular" waaaay to slow
Created by: Tirokk
Authored by roschaefer Closed
🐛 Bugreport
On our production data (17887 posts, 112179 comments on 2019-08-15 21:15), ordering the posts in the newsfeed by "Most commented" or "Popular" is so slow that you don't get a result in the first 4 seconds.
Steps to reproduce the behavior
- Run your app locally on production data (or on https://nitro-production.human-connection.org/ as soon it is rolled out)
- Filter for "Most commented" or "Popular"
- Wait and have a coffee
☕
Here is the graphql query + relevant variables: orderBy: commentsCount_desc orderBy: shoutedCount_desc
query Post($filter: _PostFilter, $first: Int, $offset: Int, $orderBy: [_PostOrdering]) {
Post(filter: $filter, first: $first, offset: $offset, orderBy: $orderBy) {
id
title
contentExcerpt
createdAt
disabled
deleted
slug
image
author {
id
avatar
slug
name
disabled
deleted
contributionsCount
shoutedCount
commentsCount
followedByCount
followedByCurrentUser
location {
name: nameEN
}
badges {
id
icon
}
}
commentsCount
categories {
id
name
icon
}
shoutedCount
}
}
Expected behavior
Waiting time should not exceed 4 seconds.
Version & Environment
robert@e480 ~/D/h/Human-Connection> chromium --version
Chromium 76.0.3809.100 Arch Linux
robert@e480 ~/D/h/Human-Connection> cat /proc/version
Linux version 5.2.6-arch1-1-ARCH (builduser@heftig-3961) (gcc version 9.1.0 (GCC)) #1 SMP PREEMPT Sun Aug 4 14:58:49 UTC 2019