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

Allow ALGORITHM=NOCOPY for ADD CONSTRAINT

Details

    Description

      The ADD FOREIGN KEY and ADD CHECK constraints currently require the table to be rebuilt with ALGORITHM=COPY.

      We could support these operations instantly if the user specified a WITHOUT VALIDATION clause. We currently do support instant ADD FOREIGN KEY after SET foreign_key_checks=0, but there is no such mechanism for ADD CONSTRAINT CHECK.

      When validation is not suppressed, we should only scan the table and validate the added constraints. There is no need to write any data to the table. For LOCK=NONE operation, we may need to ‘subscribe’ to concurrent modifications somehow.

      Attachments

        Issue Links

          Activity

            This feature would solve the problem described in MDEV-30669 (TEXT to JSON conversion).

            bar Alexander Barkov added a comment - This feature would solve the problem described in MDEV-30669 (TEXT to JSON conversion).

            I think that this is easiest to implement in the SQL layer. For checking FOREIGN KEY constraints, some type of join (outer join?) will be necessary. For anything else (CHECK or JSON validity constraints or adding a NOT NULL attribute to a column in a ROW_FORMAT=REDUNDANT table), a plain table scan would do. In the storage engine, this can be facilitated by the same APIs that serve regular SELECT and joins.

            marko Marko Mäkelä added a comment - I think that this is easiest to implement in the SQL layer. For checking FOREIGN KEY constraints, some type of join (outer join?) will be necessary. For anything else ( CHECK or JSON validity constraints or adding a NOT NULL attribute to a column in a ROW_FORMAT=REDUNDANT table), a plain table scan would do. In the storage engine, this can be facilitated by the same APIs that serve regular SELECT and joins.

            People

              sanja Oleksandr Byelkin
              marko Marko Mäkelä
              Votes:
              2 Vote for this issue
              Watchers:
              7 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.