国产精品入口蜜桃人妻,亚洲成人久久久精品,韩日欧美一区二区三区

午夜在线视频一区二区-亚洲一区成人免费电影-超碰欧美一区二区三区-大香蕉大香蕉日本大香蕉

<dl id="0cg6g"><strong id="0cg6g"></strong></dl>
<code id="0cg6g"><noframes id="0cg6g"></noframes></code>
  • <strike id="0cg6g"><input id="0cg6g"></input></strike><blockquote id="0cg6g"></blockquote>
  • <td id="0cg6g"></td>

    獲得積分
    資料庫會員登錄
    搜索: [高級搜索]
    下載首頁 | 資源分類 | 下載排行
    您的位置: 首頁 > 信息化技術 > MSSQL
     
    分類導航
    下載排行
    最新資源
    SQL server SQL語句性能差的例子
    資源大小:26.69 KB 資源類型:文檔
    下載積分: 0
    更多
    -->
    下載統計:總下載:0,本月下載:0,本周下載:0,今日下載:0
    發表評論 錯誤報告 加入收藏夾
    資源介紹
    ()where 中很多or ,會導致性能非常差,
    這樣的語句,程序會按blh,cardno,patid,tjbh,一遍遍找數據。應當改為if else
       
                      SELECT  a.*
                            FROM  TJ_TJRYK a (nolock), SF_BRXXK b (nolock), YY_DQDMK c        ,TJ_TJTDK d
                            where a.patid = b.patid  and b.qxdm *= c.id and a.tdxh=d.xh
                                    and ((    @codetype =1 and b.blh = @code)
                                        or (@codetype =2 and b.cardno = @code)
                                        or (@codetype in (3,4) and b.patid = @code1)
                                    or (@codetype =6 and a.tjbh = @code))  --add 20070611
                            order by a.xh desc
    (2)subtring和盡量減少sql語句
    --exec usp_mz_ys_gdtxs "00","20080903"--【Ztsql】
    CREATE proc usp_mz_ys_gdtxs   
    @ysdm  ut_czyh,      
    @cxrq  ut_rq16   
       
    as   
    /**********   
    [版本號]4.0.0.0.0   
    [創建時間]2006.9.25   
    [作者] ziyun     
    [版權] Copyright ? 2004-2004上海金仕達-衛寧醫療信息技術有限公司   
    [描述]門診醫生站主界面醫生信息顯示內容   
    [功能說明]   
    門診醫生站主界面醫生信息顯示內容   
    [參數說明]   
    @Ysdm  ut_czyh, --醫生代碼     
    @cxrq  ut_rq16, --查詢日期   
    @beginrq ut_rq16, --開始時間   
    @endrq  ut_rq16  --結束時間   
    [返回值]   
    [結果集、排序]   
    [調用的sp]   
    [調用實例]   
    [修改歷史]   
    **********/   
      
    declare @hour  varchar(2),@ghlb  ut_bz,@ksdm  ut_ksdm  
    select @hour=convert(varchar(2),getdate(),108)  
      
    if  @hour<='12'  
    begin  
    select @ghlb=ghlb,@ksdm=ksdm from GH_GHZDK a(nolock)   
    where  a.ysdm=@ysdm and a.jlzt=0 and a.fzbz>0 and a.ghrq like substring(@cxrq, 1, 8)+ '%'   
    and substring(a.ghrq,9,2)<='12'

    --agg: (1)substring(a.ghrq,9,2)<='12'的性能是非常差的,在這里a.ghrq like substring(@cxrq, 1, 8)+ '%'   
    --      and substring(a.ghrq,9,2)<='12' 可以改為a.ghrq>= substring(@cxrq, 1, 8) and a.ghrq<
    --      =substring(@cxrq, 1, 8)+’12’and a.ghrq>= substring(@cxrq, 1, 8) and a.ghrq>
    --      =substring(@cxrq, 1, 8)+’24’,這樣才可以很好的用到ghrq索引
    --     (2)這里如果會取出多條記錄。這樣@ghlb不是會多賦值, 是不是可以加top 1。
    end  
    else  
    begin  
    select @ghlb=ghlb,@ksdm=ksdm from GH_GHZDK a(nolock)   
    where  a.ysdm=@ysdm and a.jlzt=0 and a.fzbz>0 and a.ghrq like substring(@cxrq, 1, 8)+ '%'   
    and substring(a.ghrq,9,2)>'12'  
    end  
    --agg: substring(a.ghrq,9,2)<='12'的性能是非常差的,在這里a.ghrq like substring(@cxrq, 1, 8)+ '%'   
    --      and substring(a.ghrq,9,2)<='12' 可以改為a.ghrq>
    --      substring(@cxrq, 1, 8)+’12’,這樣才可以很好的用到ghrq索引
    --     (2)這里如果會取出多條記錄。這樣@ghlb不是會多賦值, 是不是可以加top 1。

       
    declare  @strsql varchar(1000),   
    @zrc int,@zje ut_money,@wjz int   
    下載地址
     下載地址1
    按字母檢索

    下載須知:
    大部份資源無需注冊即可下載
    需要積分的資源要在會員中心注冊會員并用 積分體系中提示的方法賺取積分才能下載。

    免責聲明:
    所有資源只能用于參考學習,不能用于任何商業用途,否則后果自負!