Subject Re: [firebird-support] Re: difference between gbak and gfix -sweep ?
Author Ann W. Harrison
svanderclock wrote:
>
> last question,

I doubt it.
>
> what is better gfix -sweep ... gbak ...
> or gbak ... gfix -sweep ...
>
> because actually i do the second one and i notice that the GBAK
> is very slooow (more than 12 hours to backup a database, and
> this everydays) ?

Is the sweep slow when done first?

It's really six of one, half dozen of the other. In both
cases sweep and gbak each read every record in every table.
If you sweep first, the sweep bears the cost of removing
record versions and index entries, but the cost is the same,
which ever tool does it.

In fact, the best combination might be gbak -g followed by
a sweep. That would make the oldest interesting higher than
doing the sweep before the backup. I think (but am not
certain) that with the -g switch, Firebird won't look beyond
the record version the gbak transaction can read. Without
the -g, Firebird will look at the record chain to see if there
are any unneeded old versions, after it's found the version
appropriate for the current transaction. So, for example,
if you start a long transaction, modify some records, run
sweep, then run gbak without the -g, Firebird is going to
explore some old record version chains that are being kept
alive by the very old transaction.

That's a small difference - looking at some old versions or
not - and you probably won't be able to measure it.

So here's my suggestion... gbak -g followed by gfix -sweep.

On the other hand, a 12 hour backup is pretty bad. What
version of Firebird do you run? Have you run a gstat with
the -r switch (combine -a and -r, I think) before the
backup to see where the garbage is collecting?


Good luck,

Ann