Subject Re: [firebird-support] How does sweeping works?
Author Ann W. Harrison
Daniel Vogelbacher wrote:
>
> The database size never shrinks (like on VACUUM in other db systems),
> thats only possible with backup&restore.
> ...right?

Right. A simple Firebird database is a single file which contains pages
of different types including indexes and data for all tables. A multi-
file Firebird database is logically a single file, split across disks.
Interspersed with the index and data pages are pages that describe the
state of transactions (committed, rolled back, limbo, or active) and
pages (in use, free). So even if you delete all the data in a table,
you haven't necessarily got free contiguous space at the end of the file.

Indexes contain record numbers which decompose into the page number of
the corresponding record plus a part that points to the length and
offset of the record on the page. Blob pages, pages that hold parts
of a record that don't fit on a single page, and a record's old
versions are all indicated by page number. So even if you have a
number of completely empty pages interspersed with other page types,
you can't compress out the empty pages to shorten the file without
rewriting all the indexes and most data pages.

So, no, we don't release space back to the disk unless you rewrite
the whole database ... and backup/restore is the usual way to do that.

Good luck,

Ann