-
Improvement
-
Resolution: Unresolved
-
Normal
-
None
-
None
-
None
The sql query to fetch listen counts, retrieves the count and max_listened_at from listen_user_metadata table. Using the max_listened_at, another query counts number of listens submitted since then. The sum of the two counts gives us the total listen count of the user.
However if the user hasn't submitted listens in a while, say a year, the max_listened_at will far back in time and accordingly a large part of the table will be searched in the second query. Thus the query and subsequently the request will execute slowly. This leads to suboptimal UI/UX on the frontend where a this user has no listens message will displayed.
See also: https://community.metabrainz.org/t/ui-bug-has-not-listened-to-any-songs-so-far/591240