update pis_p_shenhjg t set t.biaom='PIS_P_RenK' where t.biaom like 'PIS_P_Renk';
update pis_p_shenhjg t set t.biaom='PIS_P_RenK' where t.biaom='PIS_P_Renk';
麻烦大家讲解一下上面哪个执行更优一些?
还有我公司的服务器连接总是很慢,查看反正是内存占用很高,遇到这种情况可以怎么样优化一下?谢谢大家啦!

解决方案 »

  1.   

    update pis_p_shenhjg t set t.biaom='PIS_P_RenK' where t.biaom='PIS_P_Renk';
    如果在biaom上建立索引,效率更高些
      

  2.   

    第2个执行效率更高可以配置SGA和PGA大小
      

  3.   

    update pis_p_shenhjg t set t.biaom='PIS_P_RenK' where t.biaom like 'PIS_P_Renk';
    like 执行效率绝对的高。
      

  4.   

    效率一下的。。
    update pis_p_shenhjg t set t.biaom='PIS_P_RenK' where t.biaom like 'PIS_P_Renk';
     这个LIKE  会被转化为 = 的 
    要说的话就你第2个语句少了这个转化的步骤
      

  5.   

    基本没有差别,如果优化器是oracle cbo的话,请看官方文档,因为你的根本没有通配符,就像id=1与id in (1)一样的
    How the CBO Evaluates the LIKE Operator
    The optimizer simplifies conditions that use the LIKE comparison operator to
    compare an expression with no wildcard characters into an equivalent condition
    that uses an equality operator instead.
    In the following example, the optimizer simplifies the first condition into the
    second:
    last_name LIKE ’SMITH’
    is transformed into
    last_name = ’SMITH’
    The optimizer can simplify these expressions only when the comparison involves
    variable-length datatypes. For example, if last_name was of type CHAR(10), then
    the optimizer cannot transform the LIKE operation into an equality operation due
    to the equality operator following blank-padded semantics and LIKE not following
    blank-padded semantics.
    什么全表扫描不全表扫描的,like很多时候照样可以用索引,况且楼主又没有说那列上有索引
      

  6.   

    看了一些回答,我承认我流汗了,难道我out了吗?这个跟索引有一毛钱的关系吗?
      

  7.   

    一切以实际测试为主,oracle的文档也不可尽信,当然90%的文档是正确的
    回答和索引有关系的,肯定在网上或听人说的,记住:like有通配符的情况下,才和索引有一定的关系
    我说了,你的问题就如问在oracle中where id = 1与where id in (1)他们之间哪个效率高一样
      

  8.   


    这个......, 如果我是oracle公司的研发人员,基本上无视这个SQL,因为它压根什么都不用更新啊
    set的值跟condition的值一模一样,有必要作更新吗?有必要吗?
      

  9.   

    like的效率要高一些
    like不用完全匹配,所以要比=省事一些,实际测试也是这个结果,like使用的资源要少很多
    =和like都需要匹配所有的行,但为什么like过滤起来比=效率高,我想只有看了内部实现才知道
      

  10.   

        这都被你看出来了! 我想可能是楼主把set的值写错了吧!呵呵!