Skip to content

Conversation

@KirIgor
Copy link
Contributor

@KirIgor KirIgor commented Nov 7, 2025

It's useful to create ON ONLY index for partitioned table to create then concurrently indexes on each partition and then attach partition indexes.

For that I added only option for add_index.

Also I added include_invalid for indexes.

Copy link
Owner

@jeremyevans jeremyevans left a comment

Choose a reason for hiding this comment

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

Thanks for the patch! In principle I'm fine with adding these changes. However, please separate the commits appropriately (one just for :only, the other just for :include_indexes), with appropriate commit messages.

Other issues: ONLY is only supported on PostgreSQL 11+, so add the appropriate spec guard. Use a separate spec for the the include_invalid change, and update the documentation for to mention include_invalid.

# :opclass :: Set an opclass to use for all columns (per-column opclasses require
# custom SQL).
# :tablespace :: Specify tablespace for index.
# :only :: Create index only for parent table
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
# :only :: Create index only for parent table
# :only :: Create index only for given table, not for any child tables (PostgreSQL 11+)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, thank you! Done.

@jeremyevans jeremyevans merged commit fb92764 into jeremyevans:master Nov 8, 2025
@jeremyevans
Copy link
Owner

Thanks for your work on this. I thought some more about the API and decided to change include_invalid: true to invalid: :include, and add support for invalid: :only when merging.

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

Successfully merging this pull request may close these issues.

2 participants