Skip to content

Commit 27adeae

Browse files
committed
No need to inflate rating for sort
1 parent 4332085 commit 27adeae

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

adscrawler/dbcon/sql/query_apps_to_update_primary.sql

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ SELECT
4747
FROM
4848
public.store_apps AS sa
4949
CROSS JOIN countries_to_crawl AS ctc
50-
LEFT JOIN app_global_metrics_latest agm ON sa.id = agm.store_app
50+
LEFT JOIN app_global_metrics_latest AS agm ON sa.id = agm.store_app
5151
LEFT JOIN latest_crawls AS lc
5252
ON
5353
sa.id = lc.store_app
@@ -61,7 +61,12 @@ WHERE
6161
(
6262
agm.installs >= :short_update_installs
6363
OR agm.rating_count >= :short_update_ratings
64-
OR (sa.id in (select store_app from store_apps_in_latest_rankings))
64+
OR (
65+
sa.id IN (
66+
SELECT sailr.store_app
67+
FROM store_apps_in_latest_rankings AS sailr
68+
)
69+
)
6570
)
6671
AND sa.updated_at <= :short_update_ts
6772
AND (
@@ -100,7 +105,7 @@ ORDER BY
100105
END),
101106
GREATEST(
102107
COALESCE(agm.installs, 0),
103-
COALESCE(CAST(agm.rating_count AS bigint), 0) * 50
108+
COALESCE(CAST(agm.rating_count AS bigint), 0)
104109
)
105110
DESC NULLS LAST
106111
LIMIT :mylimit;

0 commit comments

Comments
 (0)