Subject Re: [firebird-support] Re: Delete all recs or drop & recreate table?
Author Kjell Rilbe
Adam wrote:

> --- In, Kjell Rilbe
> <kjell.rilbe@a...> wrote:
>>What is generally most efficient - to delete all records in a table
> or
>>to drop it and recreate it?
> I assume you mean which one is quicker, uses fewer resources and
> leaves less garbage.
> Dropping the table means that Firebird doesn't need to go through
> each record, flag it as deleted, then do the garbage collection at
> some time in the future when no other transaction is interested in
> the old data.
> Deleting all the records has the advantage of not having to worry
> about 'object in use' errors, but deleted records still appear inside
> indices until they are garbage collected, so if you have any
> transactions that run for a long time, you may find these indices
> have a lot of data. If you do choose to delete and repopulate, after
> you commit the delete, run a select count(*) on the table to force
> the garbage collection to happen.

Thank you Adam and Aage! I will use drop/recreate from now on if it
doesn't give me any problems.

Kjell Rilbe
Adressmarknaden AM AB
E-post: kjell.rilbe@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64