[MDEV-23798] Add GLOBAL indexes for partitioned tables Created: 2020-09-23  Updated: 2023-11-30

Status: Open
Project: MariaDB Server
Component/s: Partitioning
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: Manjot Singh (Inactive) Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
PartOf
is part of MDEV-12483 Add foreign keys support for partitio... Stalled

 Description   

In other RDBMS, there is the concept of GLOBAL or LOCAL indexes on partitioned tables.

MariaDB currently has LOCAL indexes, which are local to each partition in a table.

A GLOBAL index on the other hand is a one-to-many relationship, allowing one index partition to map to many table partitions and avoid the scanning behavior when partition keys are not in a query.

Implementations on other databases:

http://www.dba-oracle.com/t_global_local_partitioned_index.htm
Good justification on why postgres (and MariaDB) should have it: https://www.postgresql.org/message-id/CALtqXTcurqy1PKXzP9XO%3DofLLA5wBSo77BnUnYVEZpmcA3V0ag%40mail.gmail.com



 Comments   
Comment by Sergei Golubchik [ 2020-09-24 ]

Could you please add some justification here? Note that we already have UNIQUE constraint over all partitions.

Comment by Manjot Singh (Inactive) [ 2020-11-13 ]

My primary concerns:
1) Global indexes allow for fast partition pruning. This means we no longer have the UNION ALL type of behavior for queries without partition keys and can rely on indexed columns to choose the correct partitions and provide a significant boost for read performance.
2) This makes implementing foreign keys on partitioned tables better

Comment by Rick James [ 2021-02-22 ]

Sergei, I thought UNIQUE was not possible unless the "partition key" was included in the UNIQUEness constraint.

I agree that a global index is helpful for pruning. For example, a "range" over a HASH partitioning must now check all partitions; a global index would make pruning easy and efficient. I believe that HASH never provides performance benefits. I don't think that adding global indexing will change my mind. Can anyone provide a performance benefit relative to removing PARTITION BY HASH from the table (and adjusting the indexes if necessary)?

Generated at Thu Feb 08 09:25:08 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.