在处理大量数据时候时间过长,导致浏览器丢失。大神共享下经验吧。thinkphp数据量大浏览器

解决方案 »

  1.   

    处理大数量,与thinkphp没关。
    只与你的数据,php效率有关。
    也有可能是你的代码写得效率低
      

  2.   

    select  data_month,inpatient_no,charge_date,op_id_code,charge_code,charge_fee,dept_code,exec_unit,retprice,charge_amount,serial,bill_code,pat_name,shenqingdh
    from jx_zy_detail_charge_force
    where jx_zy_detail_charge_force.exec_unit not in (select description from jx_code_ctl where item_no like 'ordept%') and data_month='|datamonth|' 
    union all
    select  data_month,inpatient_no,charge_date,op_id_code,charge_code,charge_fee,dept_code,exec_unit,retprice,charge_amount,serial,bill_code,pat_name,shenqingdh
    from jx_zy_detail_charge_force
     where  jx_zy_detail_charge_force.exec_unit  in (select description from jx_code_ctl where item_no like 'ordept%') and  not
                 ( jx_zy_detail_charge_force.bill_code in (select description from jx_code_ctl where item_no like 'orbill%')  or
                  jx_zy_detail_charge_force.bill_code in (select description from jx_code_ctl where item_no like 'zlbill%') ) and data_month='|datamonth|'
    union all
    select  data_month,inpatient_no,charge_date,op_id_code,charge_code,charge_fee,dept_code,dept_code,retprice,charge_amount,serial,bill_code,pat_name,shenqingdh
    from jx_zy_detail_charge_force
     where   jx_zy_detail_charge_force.exec_unit  in (select description from jx_code_ctl where item_no like 'ordept%') and 
             ( jx_zy_detail_charge_force.bill_code in (select description from jx_code_ctl where item_no like 'orbill%')  or
             jx_zy_detail_charge_force.bill_code in (select description from jx_code_ctl where item_no like 'zlbill%') ) and data_month='|datamonth|'
    union all
    select  data_month,inpatient_no,charge_date,op_id_code,charge_code,charge_fee,dept_code,dept_code,retprice,charge_amount,serial,bill_code,pat_name,shenqingdh
    from jx_zy_detail_charge_force
     where  jx_zy_detail_charge_force.exec_unit is null and data_month='|datamonth|'
      

  3.   

    select  data_month,inpatient_no,charge_date,op_id_code,charge_code,charge_fee,dept_code,exec_unit,retprice,charge_amount,serial,bill_code,pat_name,shenqingdh
    from jx_zy_detail_charge_force
    where jx_zy_detail_charge_force.exec_unit not in (select description from jx_code_ctl where item_no like 'ordept%') and data_month='|datamonth|' 
    union all
    select  data_month,inpatient_no,charge_date,op_id_code,charge_code,charge_fee,dept_code,exec_unit,retprice,charge_amount,serial,bill_code,pat_name,shenqingdh
    from jx_zy_detail_charge_force
     where  jx_zy_detail_charge_force.exec_unit  in (select description from jx_code_ctl where item_no like 'ordept%') and  not
                 ( jx_zy_detail_charge_force.bill_code in (select description from jx_code_ctl where item_no like 'orbill%')  or
                  jx_zy_detail_charge_force.bill_code in (select description from jx_code_ctl where item_no like 'zlbill%') ) and data_month='|datamonth|'
    union all
    select  data_month,inpatient_no,charge_date,op_id_code,charge_code,charge_fee,dept_code,dept_code,retprice,charge_amount,serial,bill_code,pat_name,shenqingdh
    from jx_zy_detail_charge_force
     where   jx_zy_detail_charge_force.exec_unit  in (select description from jx_code_ctl where item_no like 'ordept%') and 
             ( jx_zy_detail_charge_force.bill_code in (select description from jx_code_ctl where item_no like 'orbill%')  or
             jx_zy_detail_charge_force.bill_code in (select description from jx_code_ctl where item_no like 'zlbill%') ) and data_month='|datamonth|'
    union all
    select  data_month,inpatient_no,charge_date,op_id_code,charge_code,charge_fee,dept_code,dept_code,retprice,charge_amount,serial,bill_code,pat_name,shenqingdh
    from jx_zy_detail_charge_force
     where  jx_zy_detail_charge_force.exec_unit is null and data_month='|datamonth|'
    看你的sql中亮点,是like关键字太多了,这样对性能影响很大哦,能否把sql拆分,然后用程序处理你的结果集。
      

  4.   

    查询数据库时尽量少用子查询,尽量用join和union来代替。
    可以看下这篇文章,数据库优化
    http://blog.csdn.net/timecolor/article/details/8887421
      

  5.   

    应该优化你的sql,这和thinkphp没关系。