Is `CLUSTER` applied by `pg_dump`?

Viewed 205

If CLUSTER is set on a table, then is it applied by pg_dump?

Specifically, the following:

  1. Is it used to order the rows in the dump? If not, is there a way to do this?
  2. Is it set on the table when using pg_restore? If not, is there a way to do this?
1 Answers

The dump will contain the statement

ALTER TABLE mytable CLUSTER ON anindex;

Restoring the dump will execute that statement. As the documentation explains,

This form selects the default index for future CLUSTER operations. It does not actually re-cluster the table.

Related