Subject | Re: [IBO] Q. Fastest way to insert ~6000 rows |
---|---|
Author | Daniel Rail |
Post date | 2004-05-13T11:07:56Z |
Hi,
At May 13, 2004, 07:37, tickerboo2002 wrote:
sqlAddX->>Prepare();
sqlAddY->>BeginBusy( true );
sqlAddY->>Prepare();
sqlAddZ->>BeginBusy( true );
sqlAddZ->>Prepare();
sqlAddX->>EndBusy();
sqlAddY->>Unprepare();
sqlAddY->>EndBusy();
sqlAddZ->>Unprepare();
sqlAddZ->>EndBusy();
sqlAddZ->>IB_Transaction->Commit();
If it's not TIB_DSQL, that should be the one to use.
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.
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. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)
At May 13, 2004, 07:37, tickerboo2002 wrote:
> In one of my Apps, when a user imports some data, I have to insert:sqlAddX->>BeginBusy( true );
> 6000 rows into table x
> 6000 rows into table y
> 2000 rows into table z
> At the moment, I use the following code:
sqlAddX->>Prepare();
sqlAddY->>BeginBusy( true );
sqlAddY->>Prepare();
sqlAddZ->>BeginBusy( true );
sqlAddZ->>Prepare();
> TIB_Column * pColzID= sqlAddZ->ParamByName("Z_ID");sqlAddX->>Unprepare();
> TIB_Column * pColzDesc = sqlAddZ->ParamByName("Z_DESC");
> // loop here
> pColzID->AsInteger = nID;
> pColzDesc->AsString = sDesc;
> sqlAddZ->ExecSQL();
> + the same for table x & y
sqlAddX->>EndBusy();
sqlAddY->>Unprepare();
sqlAddY->>EndBusy();
sqlAddZ->>Unprepare();
sqlAddZ->>EndBusy();
sqlAddZ->>IB_Transaction->Commit();
> 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 tableThe insert would go faster, but(in my opinion) the time saved would
> Indexes help much?
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 indexMy suggestion, don't. And, if it is possible, it might reduce the
> while I'm inserting?
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. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)