-- Files with FIXME/ERR/WARN
select count(*) from source;

-- FIXME/ERR/WARN total counts
select sum(count) as s, type from message, fixmes where message.id=message_id group by type order by s desc;
-- FIXME/ERR/WARN unique messages
select type, count(type) from message group by type;

-- Most prevalent FIXMEs
select count(count) as nr, sum(count) as s, channel, text from message, fixmes where type="fixme" and message.id=message_id group by type, channel, text order by nr desc limit 10;
-- Most prevalent ERRs
select count(count) as nr, sum(count) as s, channel, text from message, fixmes where type="err" and message.id=message_id group by type, channel, text order by nr desc limit 10;

-- Most same FIXME occurrences in a single file
select max(count) as m, count(count) as nr, channel, text from message, fixmes where type="fixme" and message.id=message_id group by type, channel, text order by m desc limit 10;
-- Most same ERR occurrences in a single file
select max(count) as m, count(count) as nr, channel, text from message, fixmes where type="err" and message.id=message_id group by type, channel, text order by m desc limit 10;

-- Most chatty channels
select channel, sum(count) as s from fixmes, message where message.id=message_id and (type="fixme" or type="err") group by channel order by s desc limit 10;
