Home > database >  Statements for oracle optimization
Statements for oracle optimization

Time:09-24

This statement to be more than 2 seconds,
Select a t1 isncode,
T2 pinbancode,
T1. Outercode
The from tblisnstatus t1 left join tblmoserialno t2
On t1. Isncode=t2. Moserialno where t1. Isncode='021 jhrhvh4000623'

The same statement, just remove the query of a field, just as long as 0.0 seconds, how to optimize the statements above??
Select a t1 isncode,
-- t2. Pinbancode,
T1. Outercode
The from tblisnstatus t1 left join tblmoserialno t2
On t1. Isncode=t2. Moserialno where t1. Isncode='021 jhrhvh4000623'

CodePudding user response:

Look at the execution plan, have what distinction, try


The select/* + */t1 RULE. Isncode,
T2 pinbancode,
T1. Outercode
The from tblisnstatus t1 left join tblmoserialno t2
On t1. Isncode=t2. Moserialno where t1. Isncode='021 jhrhvh4000623'

CodePudding user response:

Seems to have no effect, the execution plan shows: take long that turned into a full table scan, but this a few fields I have indexed,

CodePudding user response:

Fetch the data from the first sentence from two table, the second sentence annotations of table 2 fields, equivalent to fetch the data from a table, execution efficiency faster is inevitable,
The original poster to fetch the data from the two tables, it is no problem, I think in the SQL statement above, there is no room for optimization,

CodePudding user response:

The original poster can try small amount of data in the table on the left behind the join as a base table, execution efficiency, that may a bit better,

CodePudding user response:

Sorry, a reply is wrong, the original poster to ignore,

CodePudding user response:

I'm asking, since you left the join, behind also use the where filtering, the direct inner join is finished,

CodePudding user response:

I'm sorry I'm wrong, I as a table after filtering the
  • Related