Subject Re: why the data pages did increase after a backup-restore?
Author emb_blaster
--- In firebird-support@yahoogroups.com, "Ann W. Harrison" <aharrison@...> wrote:
>
> emb_blaster wrote:
> >
> > I did a backup-restore, and later a diff in gstat -h of the two files (see part of it below). I saw that num of Data pages have grow after a backup-restore. O.O
> > The average fill have increased as expected, but I don't understand this increase in dataPages.
>
> Coming after the discussion of the need for an on-line compression
> mechanism last week, yours is an interesting situation.

Hi Ann,

thanks for your always kind answers. :)
I readed that discussion, and I don't think that this on-line compression is a realy need to most of us. Anyway, i'm not the right guy to decide that =D

> Here's my
> best guess. The records are short. Ignoring unused space on pages
> and partially filled pages, the average record length is less than
> 40 bytes. That includes the record header - 13 bytes for a normal
> record, 19 bytes for a fragmented header.
>
> When a new page is created, space is reserved for back versions. The
> amount of space depends on the record size. Firebird reserves space
> for one fragmented record header per record on the page, so more
> space is reserved for small records than for large records. As records
> are modified and deleted, that space is used. My guess is that the
> growth in the number of data pages is due to the reserved space.
>

So that's where I was wrong. I thougth that space wouldn't never reserved if it is restoring a backup database. Also thougth that the the num of pages should be *always* less or equals that the old one. But I see now that it is not that way.

> So, it looks as if Firebird was doing a pretty good job of reusing
> space in your database.
>
> Cheers,
>
> Ann

Agreed!
Thanks again.