Closed JohnHien closed 5 months ago
Well, partially supported. We really don't have built-in tests for declarative partitioning since it is impossible to ensure their execution on older but still supported versions of postgresql. We currently support builds for 9.5 and 9.6. Perhaps it’s time to forget about them if someone writes a PR with declarative partitioning tests.
PS: I treat --only-indexes like sort of a deprecated option for old databases; it is better to use native reindex concurrently
in postgresql 12+
We currently support builds for 9.5 and 9.6.
Or we can exclude the tests for the older versions, because we know it's not a supported feature.
I could reproduce only the second case when pg_repack
returns error cannot create index on partitioned table concurrently
.
cannot create index on partitioned table concurrently since PG11 does not support concurrent index creation on partitioned tables.
AFAIK Postgres 16 doesn't support concurrent index creation on partitioned tables neither: https://www.postgresql.org/docs/current/sql-createindex.html#SQL-CREATEINDEX-CONCURRENTLY
Concurrent builds for indexes on partitioned tables are currently not supported. However, you may concurrently build the index on each partition individually and then finally create the partitioned index non-concurrently in order to reduce the time where writes to the partitioned table will be locked out. In this case, building the partitioned index is a metadata only operation.
This issues should be fixed by https://github.com/reorg/pg_repack/pull/398.
The PR https://github.com/reorg/pg_repack/pull/398 was merged. @ZhangHien please feel free to check it.
I used pg_repack 1.5.0 to repack the indexes of parent table and its children on both PG11 and PG14, and everything worked as expected:
However, when I used the same pg_repack command on a partitioned table, I encountered errors. The definition of the partitioned table is as follows:
On PG14, the repack_index_swap function could not find the new index index_16766 during rebuilding the index on the partitioned table because it only looks for indexes whose relkind is 'i', while the index on partitioned table has relkind 'I', so the index could not be found.
On PG11, the indexes on partitions were successfully rebuilt. But rebuilding the index on the partitioned table failed with the error:
cannot create index on partitioned table concurrently
since PG11 does not support concurrent index creation on partitioned tables.I noticed that the regression tests for pg_repack include only inherited tables cases and no partitioned tables cases. Is it because pg_repack does not support partitioned tables?