0

So I have a table that I'll simplify like this

AppId, Popularity, Date
1      50          2014-04-09
1      60          2014-04-08
2      45          2014-04-09

I want to get for a bunch of apps at once, their most recent popularity.

I have this query who works locally but takes way to long on production(more than 3 minutes)

SELECT popularity,app_id FROM `popularity`
WHERE `app_id` IN (1..1000) 
AND (`date` = (select max(date) from popularity s where s.app_id = app_id)) 
GROUP BY distribution_application_id

Is there a way to optimize it ?

Manuel Allenspach
  • 12,002
  • 13
  • 52
  • 74
Paté
  • 1,884
  • 2
  • 21
  • 32

0 Answers0