原来以为not exists 会比not in 效率高,但在实际运用过程中,发现两表数据差不多的情况下,用另一种方式效率会更好. 原设计原来以为not exists 会比not in 效率高,但在实际运用过程中,发现两表数据差不多的情况下,用另一种方式效率会更好.
原设计语句:select * from (select * from ex_22222 where exattribute1 = '13') K1 where not exists (select * from (select ex_22222.entityid from ex_22222,ut_users where exattribute1 = '13'and ex_22222.entityid = ut_users."UID") K2 where K1.ENTITYID = K2.ENTITYID)新改进语句:oracle知识库oracle知识库下载下载select K1.ENTITYID,K2.ENTITYID from (select * from ex_22222 where exattribute1 = '13') K1,(select * from (select ex_22222.entityid from ex_22222,ut_users where exattribute1 = '13'and ex_22222.entityid = ut_users."UID")) K2 where K1.ENTITYID = K2.ENTITYID(+) and K2.ENTITYID is null,
