Subject Re: [firebird-support] Getting garbage info from the database
Author Pavel Cisar

On 3 Dec 2003 at 0:44, Helen Borrie wrote:

> >1.) Can some one point me to a in depth tutorial about garbage in the
> >database?
> In my forthcoming book. :-)

Yep, unfortunately there isn't any good all-in-one article about this
topic on the web. Information is scattered across several articles about
MGA, transactions etc. You can dig around the ibphoenix web site.

> >
> >2.) How do I find out at any stage what is the state of the amount of
> >garbage in the database?
> You can't, really, except by shutting the database down and looking at the
> growth of the file(s).

While you can get the exact measure of garbage, you can get approximate
numbers from gstat: use -a and -r gstat switches. IFAIK -r switch is not
available through services API, so use really the command-line gstat. The
-r switch will lists count of row back-versions (look for total versions
and max. versions for each table). It can't distinguish between garbage
back-version and back-versions needed for active transactions, but max.
versions bigger than 3 is always suspicious (with even bigger numbers you
have really a problem :-)

> >
> >3.) How do I find out where (what tables) the garbage is affecting the
> >database?

See above.

> >4.) What is the best way to get rid on the garbage when there is
> >garbage? We currently fire <select count(*) from TableName> to the
> >database to get rid of garbage on a specific table.
> That will do it.

Yep, but I'd rather suggest the sweep (use gfix or services API to run

Best regards
Pavel Cisar (ICQ: 89017288)
For all your upto date Firebird and
InterBase information