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

LOAD DATA INFILE with ON DUPLICATE KEY UPDATE

    XMLWordPrintable

Details

    Description

      LOAD DATA is the fastest method of loading big data into table.
      It would be very useful to add ON DUPLICATE KEY clause to LOAD DATA query.

      Example: Load data and get differences

      SELECT 30 INTO @version;
      LOAD DATA INFILE 'categories.csv' INTO TABLE `raw__categories` (ID_CATEGORY,ID_LANG,NAME) SET
      last_seen_version = @version;
      ON DUPLICATE KEY UPDATE
      `last_edit_version` = IF(VALUES(`NAME`) = `NAME`, `last_edit_version`, @version ),
      `last_seen_version` = @version;

      Primary Key: ID_CATEGORY, ID_LANG

      MISSING:
      SELECT * from raw__categories WHERE `last_seen_version` < 30;
      MODIFIED
      SELECT * from raw__categories WHERE `last_edit_version` = 30;

      Attachments

        Activity

          People

            Unassigned Unassigned
            a.formella Artur Formella
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.