Skip to content
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

Add GLOBAL as IndexOption and require it explicitly for GLOBAL INDEX #52994

Closed
mjonss opened this issue Apr 29, 2024 · 0 comments · Fixed by #55264
Closed

Add GLOBAL as IndexOption and require it explicitly for GLOBAL INDEX #52994

mjonss opened this issue Apr 29, 2024 · 0 comments · Fixed by #55264
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@mjonss
Copy link
Contributor

mjonss commented Apr 29, 2024

Enhancement

For Global index (for partitioned tables) the syntax is currently not explicit, but implicitly will create an global index if:

  • the table is partitioned
  • the index is unique and does not include all the columns in the partitioning expression.

To make it easier for users to see the difference we should make both the index creation/alter and the output from SHOW CREATE TABLE to explicitly show if it is an GLOBAL or LOCAL index.

Definition:

  • a LOCAL index has the partition id as the key prefix (i.e. is local to the partition, and is maintained together with the partition)
  • a GLOBAL index has the table id as the key prefix (i.e. covers the whole/global table data, and can enforce uniqueness for the whole table, but needs separate maintenance when doing partitioning management, like removing all index entries matching a dropped/truncated partition).

Reasoning:
GLOBAL or LOCAL index for partitioned tables should be an explicit choice, since before GLOBAL INDEX is supported, only LOCAL will be implicitly chosen.
GLOBAL index will allow removing the limitation that "all unique indexes needs to include all partitioning columns" and it will also require data reorganization (costly index maintenance) for partitioning operations, such as DROP/TRUNCATE PARTITION.

Limitations:
Oracle also allows partitioning a GLOBAL index (in a different way as the table is partitioned), that is not considered here. GLOBAL INDEX means a single non-partitioned index in this context.

@mjonss mjonss added the type/enhancement The issue or PR belongs to an enhancement. label Apr 29, 2024
@mjonss mjonss changed the title Add {LOCAL|GLOBAL} INDEX as explicit syntax Add GLOBAL as IndexOption and require it explicitly for GLOBAL INDEX Jul 17, 2024
ti-chi-bot bot pushed a commit that referenced this issue Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
1 participant