Subject sweep crashes database, why?
Author mgastde
Hi all,

Sorry for the long posting but the situation needs to be explained in

I have a multifile database containing about 10 millions of records
(currently about 1.7 GB). The database is running on a FB 1.0 SS
(build 796) on a Linux machine. Forced writes are enabled.

For the following test, I used a database newly built up from a
backup. During the whole test there were no other connections to the

In my test, I've deleted about 200000 records within about 750
transaction couples (see below) from the database (this is the daily
amount to be deleted from our database in future). To free the disk
space of my deleted records immediately, I did everey delete twice
within different transactions:

delete from A
where ...
delete from A
where ...

First question:
Closing the connection after commiting the last transaction took about
90 seconds. Within this time, the ibserver process on my linux server
took the full processor power. I do not know why. Can anybody explain
this behaviour to me?

A check with gfix showed no errors.

After that, I started a database sweep manually. The sweep did not
finish during about 1 hour of work. At this point I did a normal
shutdown on my linux server. Firebird is stopped during shutdown with
the script provided by the distribution.

After restarting the server, a check with gfix reported a lot of
corrupt indices and a lot of orphan pages!!!!

Here the second question:
Is it true, that interrupting a sweep corrupts the database???? Please

I think, that a normal database and server shutdown ever MUST be
possible (as it ever can happen due to a UPS low power signal). In the
worst case, there could have been open transactions at the shutdown
time and I expect them to be rolled back with restarting the database

Third Question:
Why does the database sweep consume so much of time?

Fourth Question:
How can I avoid, that interrupting a database sweep crashes my

Fifth question:
How can I avoid to use the database sweep (scheduled or not)? How to
maintain the database without sweep?