Subject Help deleting lots of records, corrupts database
Author jamesarm97
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.

What is the correct way to delete a lot of data (not all, just before
a certain date)? What is the correct steps (delete, commit, sweep?). I
am using IBObjects in Delphi, but like I said I tried straight sql in
IBExpert.

Any help is appreciated,
James Armstrong