龙软年度综合统计数据库(lrgis_synt_stat)使用说明,包括元数据说明和使用示例。
表格格式说明
cmd_stat_2018
年度命令统计表,表名由前缀cmd_stat_+年份组成。存储了所有命令该年度的使用次数。
字段
- cmd_id:命令的ID。与表格cmd_id中id对应。
- times:本命令本年度被调用的次数。
cmd_stat_user_2018
年度用户命令统计表,表名由前缀cmd_stat_user_+年份组成。存储了所有用户的所有命令该年度的使用次数。
字段
- mcode_id:用户机器码ID。与表格user_info中的id对应。
- cmd_id:命令的ID。与表格cmd_id中id对应。
- times:本命令本年度被本机器码对应用户调用的次数。
cmd_stat_user_total_2018
年度用户命令总统计表,表名由前缀cmd_stat_user_total_+年份组成。存储了所有用户的该年度的总使用次数。与前一个表格不同的是,这里不区分命令。
字段
- mcode_id:用户机器码ID。与表格user_info中的id对应。
- times:本年本机器码对应用户调用所有命令的总次数。
synt_stat_year
各个年份基础数据表,存储年度数据。
字段
主键
- year:年份
日活量相关
- days:统计天数。
- dayAvg:日活均值。
- dayMax:日活最大值。
- maxDate:日活最大天。
- dayMin:日活最小值。
- minDate:日活最小天。
月活相关
- months:统计月数
- monthAvg:月活均值
- monthMax:月活最大值。
- maxMonth:月活最大月。
- monthMin:月活最小值。
- minMonth:月活最小月。
其他
- totalOnlineDays:所有用户当年在线总时间(天)。
- avgOnlineHour:平均每个用户每天在线时间(时)。
- userAcount:截至当前总活跃用户数量。
- lrAcount:其中龙软用户数量。
user_online_2018
年度在线统计表,表名由前缀user_online_+年份组成。存储了所有用户该年度的在线时间。
字段
- mcode:用户机器码。
- days:用户本年度在线时间(天)。
统计数据SQL语句示例
年度统计
年度基本数据
select days, dayAvg, dayMax, maxDate, dayMin, minDate, months, monthAvg, monthMax, maxMonth, monthMin, minMonth, totalOnlineDays, avgOnlineHour, userAcount, lrAcount from synt_stat_year where year = ‘2018’
年度基本数据数据直接从synt_stat_year中读取数据即可。例如2018年的基本数据如下:
- 统计天数:253
- 日活数据
均值:923.909
最大:1365(2018-12-03 00:00:00)
最小:369(2018-04-25 00:00:00) - 月活数据
月数:9
均值:2419.222
最大:3203(2018-12-01 00:00:00)
最小:980(2018-04-01 00:00:00) - 在线数据
总时间:43248.763
平均每人每天在线:4.441(小时) - 总活跃人数:13488
- 其中龙软:588
- 客户:12900(占比95.641%)
所有命令一年被使用了多少次?
select cname, times, type from cmd_stat_2018 as a, cmd_id as b where b.id = a.cmd_id order by times desc
各个专业使用了多少次?
select sum(times) as ttimes, type from cmd_stat_2018 as a, cmd_id as b where b.id = a.cmd_id group by type order by ttimes desc
各个用户使用了多少次?
select b.mcode, b.user_info, times from cmd_stat_user_total_2018 as a, user_info as b where a.mcode_id = b.id order by times desc
所有用户在线时长?
select * from user_online_2018 as a, user_info as b where a.mcode = b.mcode order by days desc
单个用户统计
登录次数:2986,平均每天11.8次
正常退出次数:2786
非正常退出次数:200(错误率6.70%)
使用版本个数:15
总在线时间:45.20天,平均每天在线4.29小时,剔除周末则是6小时!
登录次数
select count(*) from user_record_stat where login_time like ‘2018%’ and logout_time like ‘2018%’ and mcode = ‘387392472566629036’
正常退出次数
select count(*) from user_record_stat where login_time like ‘2018%’ and logout_time like ‘2018%’ and mcode = ‘387392472566629036’ and logout_mode = ‘close’
非正常退出
等于总登录次数-正常登录次数。
使用版本个数
select count(distinct(local_version)) from user_record_stat where login_time like ‘2018%’ and mcode = ‘387392472566629036’
在线时间
select days from user_online_2018 where mcode = ‘387392472566629036’
在线时间排名
select count(*)+1 from user_online_2018 where days >= (select days from user_online_2018 where mcode = ‘387392472566629036’)
命令次数
select times from cmd_stat_user_total_2018 as a, user_info as b where a.mcode_id = b.id and b.mcode = ‘387392472566629036’
命令次数排名
select count(*)+1 from cmd_stat_user_total_2018 where times >= (select times from cmd_stat_user_total_2018 as a, user_info as b where a.mcode_id = b.id and b.mcode = ‘387392472566629036’)
每个命令使用的次数
select cmd_id, cname, times, type from cmd_stat_user_2018 as a, cmd_id as b, user_info as c where a.mcode_id = c.id and c.mcode = ‘387392472566629036’ and a.cmd_id = b.id order by times desc
每个专业使用的次数
select type, sum(times) as ttimes from cmd_stat_user_2018 as a, cmd_id as b, user_info as c where a.mcode_id = c.id and c.mcode = ‘387392472566629036’ and a.cmd_id = b.id group by type order by ttimes desc