Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-12483

Add foreign keys support for partitioned tables

Details

    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.

      Attachments

        Issue Links

          Activity

            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.

            marko Marko Mäkelä added a comment - 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.

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

            manjot Manjot Singh (Inactive) added a comment - Upstream has moved partitioning to the engine level. This could be fixed within InnoDB right?

            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.

            midenok Aleksey Midenkov added a comment - 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.

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

            manjot Manjot Singh (Inactive) added a comment - So perhaps this is something better addressed as a storage engine feature, especially since FK are also storage engine features.
            jscottPTC Justin Scott added a comment -

            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.

            jscottPTC Justin Scott added a comment - 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.
            dlucas-webnet Daniel LUCAS added a comment - - edited

            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 ?

            dlucas-webnet Daniel LUCAS added a comment - - edited 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 ?

            People

              midenok Aleksey Midenkov
              valerii Valerii Kravchuk
              Votes:
              22 Vote for this issue
              Watchers:
              33 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.