[MDEV-12483] Add foreign keys support for partitioned tables Created: 2017-04-10  Updated: 2024-01-18

Status: Stalled
Project: MariaDB Server
Component/s: Partitioning, Storage Engine - InnoDB
Fix Version/s: 11.5

Type: New Feature Priority: Major
Reporter: Valerii Kravchuk Assignee: Aleksey Midenkov
Resolution: Unresolved Votes: 18
Labels: foreign-keys, partitioning, snc, upstream, upstream-not-supported

Issue Links:
Blocks
is blocked by MDEV-20480 Obsolete internal parser for FK in In... Closed
PartOf
includes MDEV-16417 Store Foreign Key metadata outside of... In Review
includes MDEV-23798 Add GLOBAL indexes for partitioned ta... Open
Relates
relates to MDEV-10393 Foreign keys SET DEFAULT action Open
relates to MDEV-11655 Transactional data dictionary Open
relates to MDEV-22361 Cross-engine foreign keys support Open
relates to MDEV-25091 CREATE TABLE: field references qualif... Closed
relates to MDEV-18320 Foreign key implicit index inconsistency Open
relates to MDEV-21175 Remove dict_table_t::n_foreign_key_ch... Closed
relates to MDEV-24273 System versioning replication fails w... Closed
relates to MDEV-32493 support foreign keys in tables partit... Open

 Description   

Please, add support for foreign keys for (at least some subset of) partitioned tables.

Generic solution for engine-independent foreign keys like the one discussed in https://dev.mysql.com/worklog/task/?id=148 may also work.

See upstream https://bugs.mysql.com/bug.php?id=46661 and numerous duplicates.



 Comments   
Comment by Marko Mäkelä [ 2017-04-10 ]

I think that properly supporting this would require that the FOREIGN KEY constraint metadata be stored at the SQL layer and not inside InnoDB. MDEV-11655 proposes the table mysql.tables_children for this purpose.

Comment by Manjot Singh (Inactive) [ 2018-04-18 ]

Upstream has moved partitioning to the engine level. This could be fixed within InnoDB right?

Comment by Aleksey Midenkov [ 2019-04-12 ]

manjot This can be fixed at InnoDB and probably should be done so as a preliminary step because the generic solution is much more time consuming.

Comment by Manjot Singh (Inactive) [ 2019-04-12 ]

So perhaps this is something better addressed as a storage engine feature, especially since FK are also storage engine features.

Comment by Justin Scott [ 2021-07-01 ]

We are starting a new project that will utilize Mariadb. The System Versioned tables feature you guys implemented is pretty awesome. When this issue is resolved will we be able to easily move our historical data to another partition? Some of the tables where we use this System Versioned feature have foreign key columns that we want to keep track of.

Comment by Daniel LUCAS [ 2023-08-28 ]

Hello,

I'm working on a client project for Webnet.

In the project we set up MariaDB system versioning on the database which is becoming slow. I read in the docs that using different partitions for the history should improve the application performance.

However, when setting up the current and history partitions I ran into the following error :

SQL Error [1506] [HY000]: (conn=6) Partitioned tables do not support FOREIGN KEY

Are there any plans to make using foreign keys in partitions possible using INNODB ?

Generated at Thu Feb 08 07:58:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.