PolarDB-O allows you to run the VACUUM command to reclaim the storage space that is occupied by dead tuples. If the released dead tuple space is reclaimed, the space is not returned to the operating system but can be used to store the newly inserted or updated data.
In the preceding figure,
tuple2 represent valid data rows, and
unused represents invalid data rows. After garbage collection, the storage space that is
occupied by invalid data rows is released and can be reused.
PolarDB-O implements the multiversion concurrency control (MVCC) mechanism by using
multiple versions. When you perform the UPDATE and DELETE operations, a new version
of data rows is generated, and the earlier version of data rows becomes invalid. The
invalid version data occupies the space of data blocks and you must clear the space
in a timely manner. Otherwise, data bloat occurs. If the number of invalid data rows
accounts for a specific proportion of the total number of data rows (you can customize
the proportion of the number of invalid rows based on your requirements), PolarDB-O
automatically triggers the garbage collection action. PolarDB-O runs the VACUUM process
to reclaim the storage space that is occupied by dead tuples. You can also manually
vacuum table_name to reclaim the storage space that is occupied by dead tuples.