Subject Re: Help deleting lots of records, corrupts database
Author Adam
--- In firebird-support@yahoogroups.com, "jamesarm97" <james@...> wrote:
>
> I have a firebird database with many tables. I have a purge utility
> that saves old records to a file, then deletes them. There is a table
> that has not been part of this process and has grown to > 2.6 million
> records. I added it, but now it gets corrupted after a delete. I am
> doing: delete from ruok where ruokstamp < 'what ever the save date
> is'; I need to be able to delete old records before a date, and keep
> the most recent ones so deleting the whole table is not an option.
>
> This takes a good bit of time to delete all the records. If I try a
> database backup after that it hangs on that table. I database
> validation also takes does not complete or if it does takes forever
> (ran overnight). Is it a database sweep problem?
>
> The firebird.log at first shows: too many setpoints (error 287). I
> broke the deletes down in to smaller chunks and now when it is over
> and try anything on the database I get: Page xxxx is an orphan,
> repeated over and over with the next page number.
>
> I have tried all sort of things, commits after each delete. I have
> even tried IBExpert with a delete from ruok; and it gets corrupted
> also. Is is a firebird issue? I am running fb 1.5. I saw there was a
> 1.5 update 1.5.6 or something.

You are most likely experiencing the cost of garbage collection. This
has been improved in 2.0. For 1.5, you might have to disable the index
before the delete and reactivate it after sweeping, or simply (after
the delete), backup with the -g option, then restore the backup file.

1.5.4 is a bug fix version only.
2.0 is the new version with improved index handling.

Adam