Skip to content

Instantly share code, notes, and snippets.

@commuterjoy
Last active December 28, 2015 18:58
Show Gist options
  • Save commuterjoy/7546478 to your computer and use it in GitHub Desktop.
Save commuterjoy/7546478 to your computer and use it in GitHub Desktop.
Simon Jenkins
set search_path to public,vlad;
-- join pageviews to content api via path
with content_ids as
(
select
id
from
content_dim
where
byline = 'Simon Jenkins'
)
select
content_ids.id, count(*) as c
from
pageviews pvs
inner join
content_ids
on
path = '/' || content_ids.id
group by
content_ids.id
order by c desc
;
Generates
```
commentisfree/2013/jun/20/brazil-saying-dont-want-costly-olympics | 128130
commentisfree/2013/aug/20/innocent-fear-david-miranda | 117288
commentisfree/2013/may/28/syria-greatest-miscalculation-fascism | 104509
commentisfree/2013/aug/29/syria-more-courage-to-say-nothing-can-do | 84949
commentisfree/2013/sep/02/west-attack-syria-idiotic-gesture | 77444
commentisfree/2013/aug/19/glenn-greenwald-journalism-david-miranda-detention | 68984
commentisfree/2013/apr/04/wheres-real-threat-kim-jong-un-trident | 60224
commentisfree/2013/aug/27/real-threat-terrorist-politicians-national-security | 59083
commentisfree/2013/jul/09/le-carre-snowden-fiction-truth | 51761
commentisfree/2013/aug/14/gibraltar-falklands-deny-logic-history | 49567
commentisfree/2013/sep/19/gchq-we-monster-we-cant-control | 47322
commentisfree/2013/apr/24/if-abenomics-works-leaders-look-like-monkeys | 47220
commentisfree/2013/may/23/woolwich-attack-echo-chamber-mass-hysteria | 44832
commentisfree/2013/jun/19/uk-response-to-nsa-story-back-off-shut-up | 41182
commentisfree/2013/jul/11/gulf-on-thames-scar-london-southbank-boris | 40855
commentisfree/2013/jun/07/nsa-surveillance-osama-bin-laden | 38930
film/filmblog/2013/jan/04/the-impossible-beautifully-accurate-film | 36446
commentisfree/2013/sep/12/michael-gove-maths-marshmallows-education-test | 31534
commentisfree/2013/apr/30/queen-elizabeth-can-learn-from-beatrix | 31117
commentisfree/2013/sep/16/spare-us-national-debate-veils | 31103
commentisfree/2013/oct/03/shard-eat-heart-out-stirling-prize | 27995
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment