Home > database >  Optimization of SQL query
Optimization of SQL query

Time:10-16

AMS_BT_UNIT_BATCH_PLAN remove a batch of data in the table, the table in order to AMS_MM_PROCESSES can get the order in the table, know AMS_BT_UNIT_BATCH_PLAN an ID, according to the order in AMS_MM_PROCESSES table, get the next , look up at the bottom of the side, is there any way to optimize

The SELECT PUNIT_PLAN_ID INTO nextPunitPlanID FROM AMS_BT_UNIT_BATCH_PLAN bt
LEFT the JOIN AMS_MM_UNIT unit ON bt. PUNIT_ID=unit.and PUNIT_ID
LEFT the JOIN AMS_MM_PROCESSES proce ON unit.and PROCESSESID=proce. PROCESSESID
WHERE MODULAR_BATCH_PLAN_ID=modularPlanID
AND proce. UER_DEFINED1=
(SELECT proce. UER_DEFINED1 + 1 FROM AMS_BT_UNIT_BATCH_PLAN bt
LEFT the JOIN AMS_MM_UNIT unit ON bt. PUNIT_ID=unit.and PUNIT_ID
LEFT the JOIN AMS_MM_PROCESSES proce ON unit.and PROCESSESID=proce. PROCESSESID
WHERE PUNIT_PLAN_ID=punitPlanID);

CodePudding user response:

Now it is slow or no data, and the outside relation you have connection

CodePudding user response:

reference 1st floor yoyohey response:
now is slow or no data, and the outside relation you have inside connection

Can not normal, found out that watching too weird, too many duplicate code

CodePudding user response:

Use with the as
  • Related