-
Notifications
You must be signed in to change notification settings - Fork 1
/
queries.sql
32 lines (23 loc) · 1.25 KB
/
queries.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
.bail on
.output /dev/null
PRAGMA foreign_keys = ON;
PRAGMA journal_mode = OFF;
PRAGMA synchronous = OFF;
PRAGMA temp_store = MEMORY;
PRAGMA cache_size = 10000;
PRAGMA mmap_size = 30000000000;
.output
select "Daily votes arrival";
-- only take fully sampled days (1 sample / min): count(distinct tick) > 1400
select avg(daygain) from (select date(sampleTime, 'unixepoch'), min(gain), max(gain), sum(gain) as daygain, count(distinct tick) from dataset group by date(sampleTime, 'unixepoch') having count(distinct tick) > 1400);
.mode column
.headers on
.nullvalue (NULL)
SELECT "best stories:";
select id, qualitySpeed, score, bestTopRank, samples, predictionSamples, 'https://news.ycombinator.com/item?id=' || id from quality where samples >= 20 order by qualitySpeed desc limit 30;
SELECT "worst stories:";
select id, qualitySpeed, score, bestTopRank, samples, predictionSamples, 'https://news.ycombinator.com/item?id=' || id from quality where samples >= 20 order by qualitySpeed asc limit 30;
select "Quality Distribution";
.headers on
.mode column
select qualitySpeed, count(*), avg(score), min(bestTopRank), avg(bestTopRank), 'https://news.ycombinator.com/item?id=' || id as example_story from quality where samples >= 20 group by floor(qualitySpeed*10) limit 100;