8000 Question: why do reindex? · Issue #17 · dataegret/pgcompacttable · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Question: why do reindex? #17

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

Open
MichaelDBA opened this issue Apr 1, 2018 · 5 comments
Open

Question: why do reindex? #17

MichaelDBA opened this issue Apr 1, 2018 · 5 comments

Comments

@MichaelDBA
Copy link
MichaelDBA commented Apr 1, 2018

A full vacuum does a rewrite of all the table and indexes, so why have REINDEX options?

btw, I love your verbose output!

@Melkij
Copy link
Collaborator
Melkij commented Apr 1, 2018

vacuum full rewrite table and all indexes, but vacuum full uses exclusive lock - and this is primary reason to using pgcompacttable or pg_repack. But pgcompactable does not use vacuum full (and no reindex command too), instead it calls updates on table and rebuild indexes by creating new index (concurrently), rename new index to old one and then drop old index.

So reindex in pgcompacttable is another stuff and has few options to control behavior.

@MichaelDBA
Copy link
Author

I understand about vacuum full and exclusive lock, and I also understand pgcompacttable is basically a vacuum full without the long locks. My question is why have REINDEX parameters for pgcompacttable since you are basically dropping indexes and creating new ones?

@alexius2
Copy link
Collaborator
alexius2 commented Apr 1, 2018

which parameters do you mean? beside creating and dropping indexes (which could be done concurrently without heavy locks) pgcompacttable also renaming newly created indexes to old name which requires short heavy lock which might not be available at a time and pgcompacttable will try to acquire it cycle with lock timeout and pause between iterations. so that's why reindex-retry-count, reindex-retry-pause, reindex-lock-timeout were introduced.

@MichaelDBA
Copy link
Author

I'm sorry but I am still not understanding you completely. When you say REINDEX, you don't mean the actual PostgreSQL REINDEX command, you mean rename command, right?

@Melkij
Copy link
Collaborator
Melkij commented Apr 2, 2018

Yes, we speaking not about reindex command (it uses heavy lock too). pgcompacttable uses word "reindex" for process create index concurrently + alter index rename + drop index concurrently.

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

No branches or pull requests

3 participants
0