Subject Re: [firebird-support] Faster insert
Author Martijn Tonies
Hi,

> I need to insert 50.000 rows in a table in the same transaction (this
insert operation must be atomic, 50.000 or nothing). But this operation is
taking too long.

Define "long".

> I use delphi + midas + ibx to access firebird and probably the midas
dataset provider is creating 50.000 inserts instead of 1 insert with 50.000
rows.
> My question is, what is the fastest way to insert these rows:
> 1. kick out midas and create a dml script in runtime;
> 1.1. create a insert statement for each row;
> 1.2. create only a insert statement with lots of lines;
>
> 2. let midas insert the rows, but add a commit(retaining) at each 500 rows
and create some external code to control if all rows was inserted; (ugly)
>
> 3. Any other idea, or solutions that you already use.

Prepare an IBX DSQL statement, fill parameters, call Execute, fill
parameters, call Execute, fill parameters ... etc.

if you can deliver a fixed-length ASCII file, take a look at External File
tables.

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com