Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create materialized view uclahiv.public.tweetbursts as
- SELECT t.tdate, t.htname, t.count, t."time"
- FROM dblink('myconn' :: text, '(with c as (SELECT date(twitterstatus.created_at) AS date,
- (jsonb_array_elements(
- ((twitterstatus.entities -> ''entities'' :: text) -> ''hashtags'' :: text)) ->>''text'' :: text) AS hashtags,
- count(id) as total,
- date_part(''hour'', created_at) as hour
- FROM twitterstatus
- GROUP BY date, hour, hashtags
- having count(id) > 20
- order by hashtags, date, hour)
- SELECT x.date, hashtags, total, hour
- from c As x
- where exists(select 1
- from c AS y
- where y.date = x.date + 1
- AND y.hashtags = x.hashtags));
- ' :: text) t (tdate date, htname text, count integer, "time" integer);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement