processing 10000 rows at the time
423548Mar 9 2005 — edited Mar 14 2005I have a problem with huge tables to update - table a - 40 mln records, table b - 5 mln. good indexes and good cost on each statement.
Here is how I find the records which are missing 10000 at the time:
procedure ppp is
cursor is
SELECT tsrd.IDENTIFIER_1, tsrd.IDENTIFIER_2
FROM TBL_SET_RESYNCH_DATA tsrd
WHERE NOT EXISTS (SELECT 1
FROM p_lead pl
WHERE pl.DBL_LEAD_AREA = tsrd.IDENTIFIER_1
AND pl.DBL_LEAD_ID = tsrd.IDENTIFIER_2)
AND TABLE_NAME = 'P_LEAD'
AND FLAG_UK = 'N'
AND ROWNUM < 10001;
begin
update the new records... on the smaller table
end;
And I have a outer procedure like this:
begin
select count ...the same query from above
while count>0 loop
run the procedure from above to update
end loop;
May be there are better ways to accomplish that.
Please, advise - any idea is greatly appreciated.
Thanks,
MJ
end;