Subject Re: [IBO] Q. Fastest way to insert ~6000 rows
Author Daniel Rail

At May 13, 2004, 07:37, tickerboo2002 wrote:

> In one of my Apps, when a user imports some data, I have to insert:

> 6000 rows into table x
> 6000 rows into table y
> 2000 rows into table z

> At the moment, I use the following code:

sqlAddX->>BeginBusy( true );

sqlAddY->>BeginBusy( true );

sqlAddZ->>BeginBusy( true );

> TIB_Column * pColzID= sqlAddZ->ParamByName("Z_ID");
> TIB_Column * pColzDesc = sqlAddZ->ParamByName("Z_DESC");

> // loop here

> pColzID->AsInteger = nID;
> pColzDesc->AsString = sDesc;
> sqlAddZ->ExecSQL();

> + the same for table x & y





> Is this the optimum way, or would I be better off using a TIB_Query?

First, what components are you using for sqlAddX, sqlAddY and sqlAddZ?
If it's not TIB_DSQL, that should be the one to use.

> Also, for such relatively small numbers, would disabling the table
> Indexes help much?

The insert would go faster, but(in my opinion) the time saved would
only be delayed to when the indices are enabled again. Since when
enabling the indices, they have to insert all the references to the
new rows and recalculate the statistics. Although the best way to know
for sure is to try it yourself and compare the times.

> Is it possible to disable the tables' PK index
> while I'm inserting?

My suggestion, don't. And, if it is possible, it might reduce the
performance because the primary key constraint wouldn't be able use
the index to perform its checks.

Best regards,
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (
ACCRA Med Software Inc. (