On 2/8/07, Dennis Cote <[EMAIL PROTECTED]> wrote:

DragonK wrote:
>
>
> Well, using transactions would be a little difficult, because I have a
> library which does something like logging to a database. Using
> transaction
> on a single insert would be useless in my opinion, and on the other
> hand I
> can't use transactions on the all inserts, since logging is a continuous
> process, it doesn't end.
>
You can basically have a transaction open all the time. Begin a
transaction on startup. Insert your log entries as they happen. Execute
a commit and another begin after every 100 records, and commit when your
program ends. You can also get more sophisticated adding a timer that
will also do a commit and begin say one second after the last log entry
if you need to. You will get a speedup by nearly a factor of 100, and if
you have a power failure or OS crash you will only lose  the uncommitted
records, not your entire database.

HTH
Dennis Cote


Thanks for your reply, Dennis -  I'll consider this alternative.




--
...it's only a matter of time...

Reply via email to