Subject Re: [IBO] Optimizing TIBOTable inserts
Author Helen Borrie
At 04:27 AM 29/06/2006, Kevin Donn wrote:
>I'd like to know what the right set of flags would be to make the
>following code go as fast as possible. The only real constraint
>that I have is that I must use a TIBOTable, although I would like to
>hear what alternatives could be made to run even faster.

In short, your problem is not about "optimizing inserts", it's about
doing absolutely the wrong thing with Delphi and IB/Fb.

Apart from anything else, you must not use these Paradox methods to
drop and add tables to IB/Fb!!

You must use a DSQL command DROP TABLE MyTable and commit the
transaction; then CREATE TABLE .... and commit the
transaction. Only when the CREATE TABLE statement returns without
exception can you start to insert data into it.

Some more points:

1. Only SYSDBA or the owner of the table is allowed to drop it.

2. If you (or anyone) have/has a dataset (such as IBOTable1 in your
example) open or prepared, DROP TABLE will fail. Same if any related
tables are in use.

3. Trying to perform DML on a table with uncommitted metadata will
corrupt your database and you won't be able to restore from a backup.

4. You can use TIB_Cursor or TIB_DSQL to perform your DDL statements
(DROP and CREATE are DDL statements). Use the EXECUTE method for
such statements.

5. Dropping and creating tables as part of a user data operation is
not a safe or sensible practice in IB/Fb.

Helen