Home > database >  Under the new background, please how to optimize the oracle query
Under the new background, please how to optimize the oracle query

Time:09-30

The select NVL (SUM (t.n num), 0) from so_saleorder_b t where
Bboutendflag='N'
AND csendstordocid in (' 1001 a110000000001cfb ', '1001 a1100000000bnaui)
And cmaterialvid=
(select pk_material as cmaterialvid from bd_material where code='0000001' and enablestate=2 and Dr=0)
And csaleorderid in (select csaleorderid from so_saleorder where fstatusflag=1 and Dr=0)
Last csaleorderid in (select csaleorderid from so_saleorder where fstatusflag=1 and Dr=0) this statement query each time spend several seconds, inquire of the optimized plan

CodePudding user response:

Manual collection this 3 tables of statistics;

CodePudding user response:

To switch to the exists

CodePudding user response:

Have indexed?

CodePudding user response:

All written there is no correlation can be

CodePudding user response:

Try index, and the conditions of the commonly used is put in front

CodePudding user response:

Increase fstatusflag so_saleorder table, Dr Field try index

CodePudding user response:

The first column of the execution plan spin point, content is not complete, can't see the specific content

CodePudding user response:

Increase composite index csaleorderid so_saleorder_b, csendstordocid cmaterialvid, and put in into the exists

CodePudding user response:

Can't see the execution plan ever go index, or a full table scan, select pk_material as cmaterialvid from bd_material where code='0000001' and enablestate=2 and Dr=0)
And csaleorderid in (select csaleorderid from so_saleorder where fstatusflag=1 and Dr=0 this sentence slowly to see if the index, the change in the exists.
  • Related