Home > database >  The general how to optimize SQL
The general how to optimize SQL

Time:10-08

The SELECT NVL (SUM (A.Q TY), 0)
-- INTO LR_TAG. QTY
The FROM TTAG_INSOUT_D A
WHERE 1=1
AND (A.S TKINSOUTNO=M_STKINSOUTNO OR M_STKINSOUTNO IS NULL)
AND (A.S TKINSOUTID=M_STKINSOUTID OR M_STKINSOUTID IS NULL)
AND (a. ATCHMARKID=M_BATCHMARKID OR M_BATCHMARKID IS NULL)
AND (a. USSSTATUS=10 OR: M_ISCREATETAG IN (0));

CodePudding user response:

Basic nothing optimization space

CodePudding user response:

Store operation when the time of high

CodePudding user response:

The execution plan posted and have a look

CodePudding user response:

The specific business logic and execution parameter information and execution plan

CodePudding user response:

Replace the or to switch to the union

CodePudding user response:

CodePudding user response:

Can't see your specific parameters and index information guess all index and high selectivity with/* + use_concat */give it a try

CodePudding user response:

Concurrent directly,

CodePudding user response:

Probably saw, estimates that will help add index, four columns, see which is better, or which a few selectivity indexed try,

CodePudding user response:

Use bind variables + dynamic SQL assembled, if the following these variables, which is not null, where a splicing,
M_STKINSOUTNO
M_STKINSOUTID
M_BATCHMARKID
M_ISCREATETAG

CodePudding user response:

Have been used for dynamic SQL splicing has been solved, thank you

CodePudding user response:

The OR UNION ALL instead, into two pieces of the SELECT, sure to be like this,
  • Related