Skip to content

Instantly share code, notes, and snippets.

@milimetric
Created July 14, 2015 21:55
Show Gist options
  • Save milimetric/fc95d765bdeb9708bde4 to your computer and use it in GitHub Desktop.
Save milimetric/fc95d765bdeb9708bde4 to your computer and use it in GitHub Desktop.
select date, project, variant, page_title,
rank() over (PARTITION by date, project, variant ORDER BY tmp.pageviews desc) as rank
(select concat(year, lpad(month, 2, '0'), lpad(day, 2, '0')) as date,
project,
variant,
page_title,
sum(view_count) as pageviews
from wmf.pageview_hourly
where year = 2015
and month = 7
and day = 1
and agent_type = 'user'
and page_title != '-'
and project = 'etwiki'
group by year, month, day, project, variant, page_title
) tmp
where rank <= 1000
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment