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

In bulk insert, pre-sort and build indexes one page at a time

Details

    Description

      In MDEV-515, the original intention was to do 2 things to speed up INSERT to an empty table or partition:

      1. Stop writing undo log records for each inserted record, and instead write just one saying that the table was empty.
      2. When the table was empty, pre-sort the records for each index, and build the indexes one page at a time, instead of the current one unsorted record at a time.

      The undo logging change turned out to be rather challenging on its own, because it affects MVCC and locking as well. Preventing the useless undo logging should speed up ROLLBACK and recovery, and also the purge of history, compensating for MDEV-12288. Hence, it makes sense to complete MDEV-515 in the limited form.

      The purpose of this task is to make INSERT into an empty table or partition even more efficient by making use of sorting. We expect data loads into huge tables with many secondary indexes to become faster. The change buffer (MDEV-11634) should no longer come into play in this case. (Huge loads into nonempty tables will be unaffected by this enhancement.)

      After implementation comments:
      The following queries will use the new optimization:

      • CREATE ... SELECT
      • Inserting into an empty table together with SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR ...
        • INSERT statement
        • INSERT ... SELECT
        • LOAD DATA INFILE

      Insert into an empty table without unique_checks=0,foreign_key_checks=0 will NOT be optimized.

      Attachments

        Issue Links

          Activity

            marko Marko Mäkelä created issue -
            marko Marko Mäkelä made changes -
            Field Original Value New Value
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            ralf.gebhardt Ralf Gebhardt made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            thiru Thirunarayanan Balathandayuthapani made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            thiru Thirunarayanan Balathandayuthapani made changes -
            Assignee Thirunarayanan Balathandayuthapani [ thiru ] Marko Mäkelä [ marko ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ] Thirunarayanan Balathandayuthapani [ thiru ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            thiru Thirunarayanan Balathandayuthapani made changes -
            Status Stalled [ 10000 ] In Progress [ 3 ]
            thiru Thirunarayanan Balathandayuthapani made changes -
            Assignee Thirunarayanan Balathandayuthapani [ thiru ] Marko Mäkelä [ marko ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            serg Sergei Golubchik made changes -
            Priority Critical [ 2 ] Major [ 3 ]
            serg Sergei Golubchik made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ] Thirunarayanan Balathandayuthapani [ thiru ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            marko Marko Mäkelä made changes -
            Assignee Thirunarayanan Balathandayuthapani [ thiru ] Axel Schwenke [ axel ]
            Priority Major [ 3 ] Critical [ 2 ]
            thiru Thirunarayanan Balathandayuthapani made changes -
            marko Marko Mäkelä made changes -
            Assignee Axel Schwenke [ axel ] Thirunarayanan Balathandayuthapani [ thiru ]
            marko Marko Mäkelä made changes -
            issue.field.resolutiondate 2021-10-26 12:18:11.0 2021-10-26 12:18:11.414
            marko Marko Mäkelä made changes -
            Fix Version/s 10.7.1 [ 26120 ]
            Fix Version/s 10.7 [ 24805 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            marko Marko Mäkelä made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 118240 ] MariaDB v4 [ 134379 ]
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Roel Roel Van de Paar made changes -
            Roel Roel Van de Paar made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Roel Roel Van de Paar made changes -
            marko Marko Mäkelä made changes -
            cmaehler Christopher Mähler made changes -
            Roel Roel Van de Paar made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            bar Alexander Barkov made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            thiru Thirunarayanan Balathandayuthapani made changes -
            marko Marko Mäkelä made changes -
            ralf.gebhardt Ralf Gebhardt made changes -
            Labels performance Preview_10.7 performance
            Roel Roel Van de Paar made changes -
            Roel Roel Van de Paar made changes -
            marko Marko Mäkelä made changes -
            alice Alice Sherepa made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            midenok Aleksey Midenkov made changes -
            marko Marko Mäkelä made changes -
            monty Michael Widenius made changes -
            Description In MDEV-515, the original intention was to do 2 things to speed up {{INSERT}} to an empty table or partition:
            # Stop writing undo log records for each inserted record, and instead write just one saying that the table was empty.
            # When the table was empty, pre-sort the records for each index, and build the indexes one page at a time, instead of the current one unsorted record at a time.

            The undo logging change turned out to be rather challenging on its own, because it affects MVCC and locking as well. Preventing the useless undo logging should speed up {{ROLLBACK}} and recovery, and also the purge of history, compensating for MDEV-12288. Hence, it makes sense to complete MDEV-515 in the limited form.

            The purpose of this task is to make {{INSERT}} into an empty table or partition even more efficient by making use of sorting. We expect data loads into huge tables with many secondary indexes to become faster. The change buffer (MDEV-11634) should no longer come into play in this case. (Huge loads into nonempty tables will be unaffected by this enhancement.)
            In MDEV-515, the original intention was to do 2 things to speed up {{INSERT}} to an empty table or partition:
            # Stop writing undo log records for each inserted record, and instead write just one saying that the table was empty.
            # When the table was empty, pre-sort the records for each index, and build the indexes one page at a time, instead of the current one unsorted record at a time.

            The undo logging change turned out to be rather challenging on its own, because it affects MVCC and locking as well. Preventing the useless undo logging should speed up {{ROLLBACK}} and recovery, and also the purge of history, compensating for MDEV-12288. Hence, it makes sense to complete MDEV-515 in the limited form.

            The purpose of this task is to make {{INSERT}} into an empty table or partition even more efficient by making use of sorting. We expect data loads into huge tables with many secondary indexes to become faster. The change buffer (MDEV-11634) should no longer come into play in this case. (Huge loads into nonempty tables will be unaffected by this enhancement.)

            After implementation comments:
            The following queries will use the new optimization:
            - CREATE ... SELECT
            - Inserting into an empty table together with SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR ...
              - INSERT statement
              - INSERT ... SELECT
              - LOAD DATA INFILE

            Insert into an empty table without unique_checks=0,foreign_key_checks=0 will NOT be optimized.
             
            monty Michael Widenius made changes -
            Description In MDEV-515, the original intention was to do 2 things to speed up {{INSERT}} to an empty table or partition:
            # Stop writing undo log records for each inserted record, and instead write just one saying that the table was empty.
            # When the table was empty, pre-sort the records for each index, and build the indexes one page at a time, instead of the current one unsorted record at a time.

            The undo logging change turned out to be rather challenging on its own, because it affects MVCC and locking as well. Preventing the useless undo logging should speed up {{ROLLBACK}} and recovery, and also the purge of history, compensating for MDEV-12288. Hence, it makes sense to complete MDEV-515 in the limited form.

            The purpose of this task is to make {{INSERT}} into an empty table or partition even more efficient by making use of sorting. We expect data loads into huge tables with many secondary indexes to become faster. The change buffer (MDEV-11634) should no longer come into play in this case. (Huge loads into nonempty tables will be unaffected by this enhancement.)

            After implementation comments:
            The following queries will use the new optimization:
            - CREATE ... SELECT
            - Inserting into an empty table together with SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR ...
              - INSERT statement
              - INSERT ... SELECT
              - LOAD DATA INFILE

            Insert into an empty table without unique_checks=0,foreign_key_checks=0 will NOT be optimized.
             
            In MDEV-515, the original intention was to do 2 things to speed up {{INSERT}} to an empty table or partition:
            # Stop writing undo log records for each inserted record, and instead write just one saying that the table was empty.
            # When the table was empty, pre-sort the records for each index, and build the indexes one page at a time, instead of the current one unsorted record at a time.

            The undo logging change turned out to be rather challenging on its own, because it affects MVCC and locking as well. Preventing the useless undo logging should speed up {{ROLLBACK}} and recovery, and also the purge of history, compensating for MDEV-12288. Hence, it makes sense to complete MDEV-515 in the limited form.

            The purpose of this task is to make {{INSERT}} into an empty table or partition even more efficient by making use of sorting. We expect data loads into huge tables with many secondary indexes to become faster. The change buffer (MDEV-11634) should no longer come into play in this case. (Huge loads into nonempty tables will be unaffected by this enhancement.)

            After implementation comments:
            The following queries will use the new optimization:
            - CREATE ... SELECT
            - Inserting into an empty table together with SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR ...
              -- INSERT statement
              -- INSERT ... SELECT
              -- LOAD DATA INFILE

            Insert into an empty table without unique_checks=0,foreign_key_checks=0 will NOT be optimized.
             
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -

            People

              thiru Thirunarayanan Balathandayuthapani
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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