I have a table T with some 500000 records. That table is a hierarchical table. My goal is to update the table by self joining the same table based on some condition for parent - child relationship The update query is taking really long because the number of rows is really high. I have created an unique index on the column which helps identifying the rows to update (meanign x and Y). After creating the index the cost has reduced but still the query is performing a lot slower.
This my query format
update T
set a1, b1
= (select T.parent.a1, T.parent.b1
from T T.paremt, T T.child
where T.parent.id = T.child.Parent_id
and T.X = T.child.X
and T.Y = T.child.Y
after creating the index the execution plan shows that it is doing an index scan for CRS.PARENT but going for a full table scan for for CRS.CHILD and also during update as a result the query is taking for ever to complete.
Please suggest any tips or recommendations to solve this problem
EXPLAIN PLAN FOR update T ....(resto uf your query)...., thenSELECT * FROM table( DBMS_XPLAN.Display ), then copy a result of last query (as a text!!!- not bitmap!!!) and append it to the question. More on explain plan command you can find here: docs.oracle.com/cd/B28359_01/server.111/b28274/…