Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> for d in c loop; insert; commit ...

for d in c loop; insert; commit ...

From: stv <stvsmth_at_gmail.com>
Date: Wed, 15 Aug 2007 16:11:48 -0600
Message-ID: <9493d0340708151511l1a4f1d6fxc88b3e9076f15b4d@mail.gmail.com>


Why in the world did I inherit a database with all this nonsense everywhere ...

	lc := 0;
	For d in C loop
		lc := lc + 1;
		# insert stuff
		if mod(lc, 50) = 0 then commit; end if;
	end loop;
	commit;

Any ideas on what problem the previous folks were attempting to get around?

I've read over Tom Kyte's explanation of why this is silly in Export Oracle Database Architecture (Ch 9, What does Commit do?) ... and he's got me convinced, so convinced that I cannot fathom why anyone would do this in the first place. I'm guessing it's common tendency, given the time Kyte spent in debunking the myth. I seem to remember redo logs, size & speed, being related to this hack, but I cannot find that reference ...

When I transitioned into the job I saw this loop non-sense and asked why ... the developer said they would have to wait for a long time without these statements. He seemed bright enough on most other things, so I let it slide for the moment (having just read Kyte's book the previous month). Now that I'm digging into code, I cannot fathom why that would be ...

I'm not an Oracle whiz by any stretch, but this has Bad Smell written all over it ...

--Steve Smith
--

http://www.freelists.org/webpage/oracle-l Received on Wed Aug 15 2007 - 17:11:48 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US