views:

128

answers:

3

As referenced by this Firefox bug, what does the act of vacuuming a database accomplish? Is this operation supported by all modern database software, or only certain ones?

A: 

It's very similiar to defragging a filesystem. More info on the PGSQL docs.

jamieb
Defragging isn't about reclaiming space. It's about reordering data in order to reduce fragmentation.
edgar.holleis
+1  A: 

It is specifically referring to SQL lite vacuum command. http://www.sqlite.org/lang_vacuum.html

It is removing space left over from DELETE statements.

MindStalker
And UPDATE statements.
edgar.holleis
+3  A: 

Databases, that use MVCC to isolate transactions from each other, need to periodically scan the tables to delete outdated copies of rows. In MVCC, when a row is updated or deleted, it cannot be immediately recycled, because there might be active transactions that can still see the old version of the row. Instead of checking if that is the case, which could be quite costly, old rows are assumed to stay relevant. The process of reclaiming the space is deferred until the table is vacuumed, which depending on the database, can be initiated automatically, or explicitly.

edgar.holleis