[DB-SIG] MS SQL Server and odbc getting 'None'

Carey David SSgt 109CF/SCBJ David.Carey at nyscot.ang.af.mil
Wed Aug 18 14:19:12 CEST 2004

Thanks for the information. I was wondering a little bit about the overhead
of the commit like you said, but figured even if it was a lot, it wouldn't
be too bad for me because it would only be going for a few minutes at a
time. I'd only be doing a few hundred per shot at most. Its also good to
hear that it doesn't use all that much overhead.


-----Original Message-----
From: Andy Todd [mailto:andy47 at halfcooked.com] 
Sent: Tuesday, August 17, 2004 12:01 PM
To: Carey David SSgt 109CF/SCBJ
Cc: Python DB-SIG Mailing List
Subject: Re: [DB-SIG] MS SQL Server and odbc getting 'None'

Carey David SSgt 109CF/SCBJ wrote:
>  Ok, I believe I see. If I'm doing multiple updates/inserts inside a 
> loop, is it better to commit inside the loop with each execute, or 
> outside the loop and commit just once? I would assume that committing 
> outside the loop would be the best.
> I hope I made that clear.
> Thanks
> Dave

The answer is, of course, it depends. If each of your updates/inserts is
independent then commit within the loop. If they all have to make it to the
database or none do commit after the loop. Essentially you commit after each
'atomic' piece of work.

People worry about the processing overhead of a commit. It does, after all,
add at least a couple of processor cycles. But unless your throughput is of
the order of many thousands of records a second you are unlikely to notice
the extra effort of a commit after each operation. 
Modern relational databases are quite good at this kind of thing after all.

 From the desk of Andrew J Todd esq - http://www.halfcooked.com/

More information about the DB-SIG mailing list