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

LOAD DATA INFILE with ON DUPLICATE KEY UPDATE

    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;

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                Unassigned
                Reporter:
                a.formella Artur Formella
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: