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 existsCodePudding user response:
Have indexed?CodePudding user response:
All written there is no correlation can beCodePudding user response:
Try index, and the conditions of the commonly used is put in frontCodePudding user response:
Increase fstatusflag so_saleorder table, Dr Field try indexCodePudding user response:
The first column of the execution plan spin point, content is not complete, can't see the specific contentCodePudding user response:
Increase composite index csaleorderid so_saleorder_b, csendstordocid cmaterialvid, and put in into the existsCodePudding 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.