Indexed Optimization of Correlated Subqueries in UPDATE Statements

From InterBase
Jump to: navigation, search

Go Up to Correlated Subqueries


An indexed retrieval is now used to fetch rows from the correlated subquery in the UPDATE statement if there is an appropriate index defined. Utilize an indexed access path for correlated subqueries in UPDATE statements as in the following code example:

UPDATE A SET A.C1 = (SELECT B.C1 FROM B WHERE B.C2 = A.C2)

Where index is B.C2, InterBase will use index to retrieve the matching row in table B where B.C2 = A.C2, since the row in the outer table A has already been fetched.