not in 不好 可以用not exits 取代

解决方案 »

  1.   

    我知道NOT IN 的效率没NOT EXITS好,我的问题就在这,这怎么换成EXITS语句,不同的用户同时执行一个存储过程当然可以(这里的执行指客户端),我理解为,服务端还是产生了队列,一个个的执行,我的意思是能否让服务端并行的处理呢。
      

  2.   

    改不了not exists能不能考虑在另一台服务器运行?
      

  3.   

    是不哦,就信你一次,呵呵!难道这句SQL就不能提高点效率吗?就是把服务器GPINFO里的表中的新记录插到链接服务器中的表中
      

  4.   

    Select a.cg_barCode,a.cg_name,a.mg_uprice,a.mg_ucost from Gpinfo a left join (OpenQuery(YULE,'Select cg_barcode from Gpinfo'))
    b on a.cg_barCode = b.cg_barcode  and a.cg_barCode is null
      

  5.   

    Select a.cg_barCode,a.cg_name,a.mg_uprice,a.mg_ucost from Gpinfo a left join (OpenQuery(YULE,'Select cg_barcode from Gpinfo'))
    b on a.cg_barCode = b.cg_barcode  where a.cg_barCode is null
      

  6.   

    Select a.cg_barCode cg_barCode ,a.cg_name,a.mg_uprice,a.mg_ucost from Gpinfo a left join (OpenQuery(YULE,'Select cg_barcode from Gpinfo'))
    b on a.cg_barCode = b.cg_barcode  where cg_barCode is null
      

  7.   

    我用了3种方法,分别是NOT IN,INNER JOIN,NOT EXISTS
    NOT IN 执行速度最慢,服务器累计等待时间最小
    NOT EXISTS比INNER JOIN稍微快点点,但是服务器累计等待时间最长,客户端执行时间最短
    By the Way,谁能给我讲一下,怎么在查询分析器里的执行计划的成本分析里看查询的效率