aboutsummaryrefslogtreecommitdiffstats
path: root/webstats/queries.sql
diff options
context:
space:
mode:
Diffstat (limited to 'webstats/queries.sql')
-rw-r--r--webstats/queries.sql11
1 files changed, 11 insertions, 0 deletions
diff --git a/webstats/queries.sql b/webstats/queries.sql
index 2a3f762..5e16da0 100644
--- a/webstats/queries.sql
+++ b/webstats/queries.sql
@@ -19,3 +19,14 @@ DROP TABLE IF EXISTS STATS
-- Insert a data point
INSERT INTO STATS (click, page, referrer, ip, user_agent, title)
VALUES (:click, :page, :referer, :ip, :user_agent, :title)
+
+
+-- name: activity-stats
+-- timeseries of activity
+SELECT
+ (timestamp / 600) * 600 AS time,
+ count(*)
+FROM
+ STATS
+GROUP BY
+ 1;