




已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
各位:最近在优化肿瘤系统的一个查询统计的时候碰到一个性能问题。具体的统计要求如下:相信大家在以往的工作中也碰到过类似的的统计。根据我们平常的经验做法,我们一般会把统计SQL携程类似的形式:select g.icd_group, g.group_name, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG 3 and IS_DELETE = 0 and t.PRESENT_RESIDENCE like 4401%) as total, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a0, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG 3 and t.PRESENT_RESIDENCE like 4401% and 1 * 12 months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a0_5, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG months_BETWEEN(t.diagnose_date, t.birthday) and 5 * 12 = months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a5_10, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG months_BETWEEN(t.diagnose_date, t.birthday) and 10 * 12 = months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a10_15, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG months_BETWEEN(t.diagnose_date, t.birthday) and 15 * 12 = months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a15_20, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG months_BETWEEN(t.diagnose_date, t.birthday) and 20 * 12 = months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a20_25, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG months_BETWEEN(t.diagnose_date, t.birthday) and 25 * 12 = months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a25_30, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG months_BETWEEN(t.diagnose_date, t.birthday) and 30 * 12 = months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a30_35, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG months_BETWEEN(t.diagnose_date, t.birthday) and 35 * 12 = months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a35_40, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG months_BETWEEN(t.diagnose_date, t.birthday) and 40 * 12 = months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a40_45, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG months_BETWEEN(t.diagnose_date, t.birthday) and 45 * 12 = months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a45_50, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG months_BETWEEN(t.diagnose_date, t.birthday) and 50 * 12 = months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a50_55, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG months_BETWEEN(t.diagnose_date, t.birthday) and 55 * 12 = months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a55_60, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG months_BETWEEN(t.diagnose_date, t.birthday) and 60 * 12 = months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a60_65, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG months_BETWEEN(t.diagnose_date, t.birthday) and 65 * 12 = months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a65_70, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG months_BETWEEN(t.diagnose_date, t.birthday) and 70 * 12 = months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a70_75, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG months_BETWEENdiagnose_date(t., t.birthday) and 75 * 12 = months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a75_80, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG months_BETWEEN(t.diagnose_date, t.birthday) and 80 * 12 = months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a80_85, (select count(*) from report t where t.INTERVIEW_DISTRIBUTE_STATE != 5 and t.icd_group like g.icd_group | % and t.IS_PASS_REVIEW = 2 and t.REPEATED_DISPOSE_FLAG 3 and t.PRESENT_RESIDENCE like 4401% and 85 * 12 = months_BETWEEN(t.diagnose_date, t.birthday) and IS_DELETE = 0) as a85_ from dict_icd_group g order by g.sn但是,这种统计方法在处理肿瘤系统十万多的数据量的情况下性能已经达不到要求,更不用说百万以上的数据量了,不管怎么设置索引处理时间都在10秒以上。因此,这次在做性能优化的时候我尝试了一个多年前构思但一直没有真正实现过的一种统计方法。
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年临沂沂南县教育系统部分事业单位公开招聘教师(5名)模拟试卷附答案详解(考试直接用)
- 2025年阜阳临泉技工学校招聘4人模拟试卷及答案详解(名师系列)
- 2025年丹江口事业单位真题
- 2025年合肥长丰县部分单位招聘39人模拟试卷完整答案详解
- 2025年内江市市本级部分事业单位公开考核招聘工作人员(第二批)的考前自测高频考点模拟试题完整答案详解
- 2025年灯塔市市级机关公开遴选考试真题
- 2025福建莆田市数字集团有限公司选聘11人模拟试卷有完整答案详解
- 国庆节周记模板集合4篇
- 2025江苏无锡市锡山区卫生健康系统招聘事业编制高层次人才21人(长期)考前自测高频考点模拟试题及1套参考答案详解
- 2025年陕西国网三批招聘已发布(59人)考前自测高频考点模拟试题及1套完整答案详解
- 糖尿病酮症酸中毒护理疑难病历讨论
- SF6设备带压封堵技术规范2023
- 大数据与人工智能在冶金产业的应用-洞察阐释
- 三年级信息科技第28课《初识人工智能》教学设计、学习任务单及课后习题
- 监理工程师借调合同协议书范本三方版5篇
- 培养“最好的我”新时代品质少年-学校课程规划与实施方案
- 2025年全球及中国晶须碳纳米管行业头部企业市场占有率及排名调研报告
- 犁底层重构施工方案
- 2025年高中政治必修四《生活与哲学》全册基础知识点总结汇编(全册)
- 《工商管理专业导论》课件
- Unit 1 Teenage life单词变形-学生背诵与默写清单-2024-2025学年高中英语人教版(2019)必修第一册
评论
0/150
提交评论