diff --git a/api/dbv1/get_playlists.sql.go b/api/dbv1/get_playlists.sql.go index 8e9c5984..04fde37e 100644 --- a/api/dbv1/get_playlists.sql.go +++ b/api/dbv1/get_playlists.sql.go @@ -24,7 +24,8 @@ WITH my_follows AS ( AND follower_user_id = $1 AND follows.is_delete = false ORDER BY follower_count DESC - LIMIT 5000 + -- See get_tracks.sql for rationale. + LIMIT 200 ) SELECT p.description, diff --git a/api/dbv1/get_tracks.sql.go b/api/dbv1/get_tracks.sql.go index f5ee3142..09592ef9 100644 --- a/api/dbv1/get_tracks.sql.go +++ b/api/dbv1/get_tracks.sql.go @@ -24,7 +24,11 @@ WITH my_follows AS ( AND follower_user_id = $1 AND follows.is_delete = false ORDER BY follower_count DESC - LIMIT 5000 + -- The two consumers (followee_reposts, followee_favorites) both + -- emit at most 3 rows ordered by follower_count DESC. Caring about + -- followees ranked >200 by follower_count is wasted work: they're + -- ~always dominated by the top-200 in social-proof terms. + LIMIT 200 ) SELECT t.track_id, diff --git a/api/dbv1/queries/get_playlists.sql b/api/dbv1/queries/get_playlists.sql index 4fe07d44..03324895 100644 --- a/api/dbv1/queries/get_playlists.sql +++ b/api/dbv1/queries/get_playlists.sql @@ -9,7 +9,8 @@ WITH my_follows AS ( AND follower_user_id = @my_id AND follows.is_delete = false ORDER BY follower_count DESC - LIMIT 5000 + -- See get_tracks.sql for rationale. + LIMIT 200 ) SELECT p.description, diff --git a/api/dbv1/queries/get_tracks.sql b/api/dbv1/queries/get_tracks.sql index 4702daaa..794766bc 100644 --- a/api/dbv1/queries/get_tracks.sql +++ b/api/dbv1/queries/get_tracks.sql @@ -9,7 +9,11 @@ WITH my_follows AS ( AND follower_user_id = @my_id AND follows.is_delete = false ORDER BY follower_count DESC - LIMIT 5000 + -- The two consumers (followee_reposts, followee_favorites) both + -- emit at most 3 rows ordered by follower_count DESC. Caring about + -- followees ranked >200 by follower_count is wasted work: they're + -- ~always dominated by the top-200 in social-proof terms. + LIMIT 200 ) SELECT t.track_id,