Skip to content
Last updated

Page View Example Queries

A number of page views. This is often used to measure the popularity of the website.

Page View Query Syntax Example for Hive and Presto

SELECT 
  TD_TIME_FORMAT(time,
    'yyyy-MM-dd',
    'JST') AS DAY,
  COUNT(1) AS pv
FROM
  access
GROUP BY
  TD_TIME_FORMAT(time,
    'yyyy-MM-dd',
    'JST')
ORDER BY
  DAY ASC

Sample Input

timeuser_id
14164355852
14164355863
14164355875
14164355881
......

Sample Output

daycnt
2014-10-01621
2014-10-02121
2014-10-0371
2014-10-0461
2014-10-0541
2014-10-0631
2014-10-0711
2014-10-083
2014-10-091