SELECT B~VGBEL B~VGPOS B~LFIMG A~KOSTA INTO CORRESPONDING FIELDS OF TABLE IT_TEMP3 FROM VBUP AS A JOIN LIPS AS B ON A~VBELN = B~VBELN AND A~POSNR = B~POSNR WHERE A~KOSTA <> 'C'.
SELECT B~VBELN B~POSNR B~VGBEL B~VGPOS B~LFIMG A~KOSTA INTO CORRESPONDING FIELDS OF TABLE IT_TEMP3 FROM VBUP AS A JOIN LIPS AS B ON A~VBELN = B~VBELN AND A~POSNR = B~POSNR FOR ALL ENTRIES IN ITAB WHERE B~VGBEL = ITAB-VBELN AND B~VGPOS = ITAB-POSNR AND A~KOSTA <> 'C' .
以上两段代码运行时间差非常多,在第一段中只需要4秒左右,而第二段中用FOR ALL ENTRIES IN却需要近70秒。对于FOR ALL ENTRIES IN的时候,WHERE子句中的条件如果不是索引会是更慢吗?还是其他原因,因为在第一段中即使全部数据取出来也只有4535条记录。