June 2024
Intermediate to advanced
456 pages
11h 34m
English
Besides table data, indexes become bloated over time with entries to refer to dead tuples. To optimize your indexes, periodically rebuild the important ones.
Fortunately, PostgreSQL made it possible to rebuild indexes while they’re being used concurrently, starting in version 12.
If you’re on an earlier version of PostgreSQL, to get this functionality, the best bet is to upgrade to PostgreSQL 12 or newer. If upgrading is not an option, third-party tools like pg_repack[230] can be used to achieve similar results.
The post, “Using pg_repack to Rebuild Indexes,”[231] shows how to install and use it. This approach builds a replacement index in the background and then swaps the names between the original index ...
Read now
Unlock full access