Subject Re: sweep taking a long time
Author Adam
> >>
> >As far as I know gbak -g parameter stops garbage collection from
> >running during backup, so even if I make restore after backup without
> >garbage collection(gbak -b -g), I should perform sweep... (?)
> >
> >Kevin Smith
> >
> When you backup your data, just the "good" data goes to the backup, no
> garbage is stored in the backup, so it will not be restored.

Also, the purpose of garbage collection during backup is not to
benefit the backup file. Firebird Classic has no dedicated garbage
collection thread, which means that in an archival type system,
garbage may never be cleaned out. Since backup reads every record, it
makes sense that it cleans up any garbage as it goes. (Remember that
most of the time you hope you never have to use the backup you make).

Due to a limitation in the Firebird 1.5 ODS, indices with lots of
duplicates cause headaches to the garbage collection process,
significantly slowing it down. That is fine if it is a user defined
index, you can just add the primary key to the end of it to make it
unique, but for foreign keys you have no choice. Firebird 2 resolves
this issue by storing the indices slightly differently, but until that
is ready, you will have to wait.

So by default, when you backup the database, it is cleaned up at the
same time. There may be occasions where you don't want to wait for it
to clean, such as if the backup is taking too long, or if you plan on
restoring the database and using the newly restored copy, and that is
when you use the -g switch.