Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLUSTER under the Offline portion? #632

Closed
andyatkinson opened this issue Feb 28, 2024 · 2 comments
Closed

CLUSTER under the Offline portion? #632

andyatkinson opened this issue Feb 28, 2024 · 2 comments

Comments

@andyatkinson
Copy link
Contributor

andyatkinson commented Feb 28, 2024

Hi @keithf4

The CLUSTER tip is good, although since this command acquires a AccessExclusiveLock on the table [1], do you think it makes sense to locate this information under the OFFLINE portion of the documentation only, as opposed to above the section that separates offline from online?

[1] https://pglocks.org/?pgcommand=CLUSTER

One tip that may possibly help with the speed/load of partitioning a table would be to run a CLUSTER on the original source table using the partition key's index shortly before the partitioning is done. Since the data will be read sequentially from the source table, having it be in order could potentially help with IO efficiency on very large tables. See the PostgreSQL documentation - https://www.postgresql.org/docs/current/sql-cluster.html

Perhaps pg_repack could be mentioned for an "online" alternative to running CLUSTER [2]

[2] Online CLUSTER (ordered by cluster index) https://reorg.github.io/pg_repack/

@keithf4
Copy link
Collaborator

keithf4 commented Mar 6, 2024

I'll just add a note about it being an exclusive lock. Thanks!

@keithf4
Copy link
Collaborator

keithf4 commented Apr 5, 2024

Version 5.1 has been released with this update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants