Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> need help with an update
Hi all:
May be someone can help me to tune this update ...
update A1 a
set a.empl_hrchy_id =
(select maxid from B1 b
where a.usr_id = b.usr_id)
where exists
(select 'x' from B1 where usr_id = a.usr_id)
Table A1 has several million rows (5 to 6), table B1 has no more than 5 thousand rows.. A1 is indexed on the fields, usr_id, usr_id/empl_hrchy_id and empl_hrcy_id/usr_id. B1 has no indices. The explain plan shows a full table scan against the A1 table, which is something I'd like to avoid. Is there a way to make Oracle use an index instead (without hints)?
thanks
Gene
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Gurelei INET: gurelei_at_yahoo.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-LReceived on Mon May 05 2003 - 12:31:55 CDT
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).