Skip to content

[docs] Add instructions to recreate a partition index#31362

Open
jaki wants to merge 14 commits into
yugabyte:masterfrom
jaki:docs-recreate-partition-index
Open

[docs] Add instructions to recreate a partition index#31362
jaki wants to merge 14 commits into
yugabyte:masterfrom
jaki:docs-recreate-partition-index

Conversation

@jaki

@jaki jaki commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a new section to the YSQL documentation titled "Recreate a partition index", providing a step-by-step guide for recreating indexes on partitioned tables online using a detach-and-reattach strategy. The feedback suggests changing the language tag of the example code block from "plpgsql" to "sql" to ensure more accurate syntax highlighting, as the block contains standard SQL statements rather than procedural code.

To recreate indexes, you should avoid directly creating an index on the partitioned table (parent table) because that cannot use `CONCURRENTLY`.
Follow these steps to recreate a partition index online:

```plpgsql

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The code block contains a sequence of standard SQL DDL and DML statements rather than PL/pgSQL procedural code. Using the sql language tag is more appropriate for syntax highlighting in this context.

Suggested change
```plpgsql
```sql

@netlify

netlify Bot commented Apr 30, 2026

Copy link
Copy Markdown

Deploy Preview for infallible-bardeen-164bc9 ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 1ebf4e3
🔍 Latest deploy log https://app.netlify.com/projects/infallible-bardeen-164bc9/deploys/6a33119b8372e30008f8bc38
😎 Deploy Preview https://deploy-preview-31362--infallible-bardeen-164bc9.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-project-automation github-project-automation Bot moved this to In progress in Documentation Apr 30, 2026
@jasonyb jasonyb requested a review from aishwarya24 April 30, 2026 03:16

@aishwarya24 aishwarya24 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor comments.

Comment thread docs/content/stable/api/ysql/the-sql-language/statements/ddl_create_index.md Outdated
Comment thread docs/content/stable/api/ysql/the-sql-language/statements/ddl_create_index.md Outdated
@iSignal

iSignal commented May 20, 2026

Copy link
Copy Markdown
Contributor

@jaki : @aishwarya24 : Would be good to place the existing steps which deal with related scenarios at https://docs.yugabyte.com/stable/api/ysql/the-sql-language/statements/ddl_create_index/#only along with this new section together. Maybe we can move the current section and this new part into a new subsection like Concurrent index creation for partitioned tables


Concurrent index creation for partitioned tables

Creating indexes concurrently on partitioned tables

/* Current docs */

Recreating unique index constraints concurrently on partitioned tables

Recreating unique index constraints involves a similar process as the previous section. However, there is an extra challenge that dropping an existing inherited constraint is not allowed. You can follow this sequence below when object locking is enabled.
/* new docs */

jaki added 11 commits June 5, 2026 14:29
Make the recreate-partition-index note accurate about the
optional protected path:

- Step 4 LOCK and its surrounding BEGIN/COMMIT block are jointly
  optional; drop both and run the steps individually if the
  parent has no concurrent reads or writes during the detach.
- Object locking (enable_object_locking_for_table_locks) gates
  the LOCK.
- Transactional DDL (ysql_yb_ddl_transaction_block_enabled)
  gates the BEGIN/COMMIT block, and object locking depends on
  it.  Neither flag is a preview flag in 2025.2+, so no
  allowed_preview_flags_csv entry is needed.

Also reword the step 6 comment to drop the inaccurate
"inherited", since the partition is already detached by then.
@jaki jaki force-pushed the docs-recreate-partition-index branch from bf27b51 to 94c3e8d Compare June 17, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

4 participants