Subject | Re: [firebird-support] Bulk Insert Skript |
---|---|
Author | Milan Babuskov |
Post date | 2008-07-14T08:33:05Z |
Stefan Heymann wrote:
some of inserts fail - I suggest you use a single transaction. Also, it
you want the operation to be atomic (either all is inserted or none).
Imagine that you have a power failure or operating system crashes in the
middle of importing. If you commit after each insert, you would have to
track what the programs has already done, and only insert those that
aren't in database ready (once you re-start the job).
It all depends on your needs. I prefer clean, atomic operations that can
easily be retried and restarted at any time.
BTW, I have scripts that insert 500-600k of values in a single
transaction and it all works fine.
--
Milan Babuskov
http://www.guacosoft.com
> I have an SQL script that inserts a few thousand rows into my FirebirdIt all depends. If you want to be able to ROLLBACK the whole batch is
> database.
>
> It will run when nobody else is connected to the database and when
> there are no other transactions running concurrently.
>
> Execution time does NOT matter.
>
> Is it better to COMMIT every single insert?
some of inserts fail - I suggest you use a single transaction. Also, it
you want the operation to be atomic (either all is inserted or none).
Imagine that you have a power failure or operating system crashes in the
middle of importing. If you commit after each insert, you would have to
track what the programs has already done, and only insert those that
aren't in database ready (once you re-start the job).
It all depends on your needs. I prefer clean, atomic operations that can
easily be retried and restarted at any time.
BTW, I have scripts that insert 500-600k of values in a single
transaction and it all works fine.
--
Milan Babuskov
http://www.guacosoft.com