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 {LOCAL|GLOBAL} INDEX as explicit syntax #52994

Open
mjonss opened this issue Apr 29, 2024 · 0 comments
Open

Add {LOCAL|GLOBAL} INDEX as explicit syntax #52994

mjonss opened this issue Apr 29, 2024 · 0 comments

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant