You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
5.6 KiB
5.6 KiB
school_stat_hour 表文档
表概述
表名: school_stat_hour
功能: 统计课时数据表,用于按小时维度统计各种业务指标数据,支持24小时精细化数据统计和多维度数据分析,为业务决策和性能监控提供详细的时间序列数据支持
字段说明
Field Type Collation Null Key Default Extra Privileges Comment
id int unsigned NULL NO PRI NULL auto_increment select,insert,update,references
addon varchar(255) utf8mb4_general_ci NO select,insert,update,references 插件
field varchar(255) utf8mb4_general_ci NO select,insert,update,references 统计字段
field_total decimal(10,2) NULL NO 0.00 select,insert,update,references 总计
year int NULL NO 0 select,insert,update,references 年
month int NULL NO 0 select,insert,update,references 月
day int NULL NO 0 select,insert,update,references 天
start_time int NULL NO 0 select,insert,update,references 当日开始时间戳
last_time int NULL NO 0 select,insert,update,references 最后执行时间
hour_0 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_1 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_2 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_3 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_4 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_5 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_6 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_7 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_8 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_9 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_10 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_11 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_12 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_13 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_14 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_15 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_16 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_17 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_18 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_19 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_20 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_21 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_22 decimal(10,2) NULL NO 0.00 select,insert,update,references
hour_23 decimal(10,2) NULL NO 0.00 select,insert,update,references
功能用途
主要功能
- 小时级数据统计: 按小时维度统计各种业务指标数据
- 多维度统计: 支持按插件、字段、年月日等多维度进行数据统计
- 实时数据汇总: 提供24小时内每小时的数据汇总和总计
- 统计字段管理: 灵活配置不同的统计字段和计算方式
- 时间序列分析: 支持基于时间序列的数据分析和趋势预测
- 数据聚合: 将分散的业务数据按时间维度进行聚合统计
业务场景
- 营收统计: 按小时统计学校的收入、支出、利润等财务数据
- 学员活跃度: 统计每小时的学员登录、课程学习、互动等活动数据
- 课程使用情况: 按小时统计课程的观看时长、完成率等指标
- 系统性能监控: 统计系统的访问量、响应时间、错误率等技术指标
- 教师工作量: 按小时统计教师的授课时长、学员互动等工作数据
- 设备使用率: 统计教学设备、场地的使用情况和利用率
- 数据报表生成: 为管理层提供详细的小时级业务数据报表
关联关系
主要关联表
- school_addon: 通过addon字段关联插件信息
- school_member: 可能关联会员相关的统计数据
- school_course: 可能关联课程相关的统计数据
- school_pay: 可能关联支付相关的统计数据
- school_personnel: 可能关联人员相关的统计数据
关联说明
addon: 标识统计数据来源的插件或模块field: 定义具体的统计字段类型(如收入、学员数、课时等)- 通过年月日字段与其他业务表的时间字段形成关联
- 支持多种业务数据的统计汇总,具体关联关系取决于统计字段的定义
索引建议
-- 主键索引(已存在)
PRIMARY KEY (id)
-- 插件查询索引
INDEX idx_addon (addon)
-- 统计字段索引
INDEX idx_field (field)
-- 时间维度索引
INDEX idx_date (year, month, day)
-- 复合索引:插件+字段
INDEX idx_addon_field (addon, field)
-- 复合索引:插件+时间
INDEX idx_addon_date (addon, year, month, day)
-- 复合索引:字段+时间
INDEX idx_field_date (field, year, month, day)
-- 开始时间索引
INDEX idx_start_time (start_time)
-- 最后执行时间索引
INDEX idx_last_time (last_time)
注意事项
- 数据精度: 使用decimal类型确保统计数据的精度,避免浮点数误差
- 时间同步: 确保统计时间与业务数据的时间保持同步
- 数据一致性: 统计数据应与源数据保持一致,定期进行数据校验
- 性能优化: 大量数据统计时需要考虑性能优化和分批处理
- 存储空间: 24个小时字段占用较多存储空间,需要定期清理历史数据
- 并发控制: 多个统计任务同时执行时需要避免数据冲突
- 异常处理: 统计过程中的异常情况需要有完善的错误处理机制
- 数据备份: 重要的统计数据需要定期备份,防止数据丢失