Contents / Previous / Next


Performance

Indexes

For a large table, it can take minutes to check every row. Using an index, finding a specific row takes fractions of a second.

CLUSTER

The CLUSTER command reorders the table file to match the ordering of an index.

VACUUM

When POSTGRESQL updates a row, it keeps the original copy of the row in the table file and marked it as expired to be used by other transactions still viewing the database in its prior state.
The VACUUM command removes expired rows from the file.
Using VACUUM alone vacuums all tables in the database.
Using VACUUM tablename vacuums a single table.