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

Performance regression in INSERT…SELECT due to unnecessarily making InnoDB log durable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Fixed
    • 10.6.9, 10.6.18, 10.6.19, 10.6.20, 10.11.10
    • 10.6.22, 10.11.12, 11.4.6, 11.8.2

    Description

      Profiling shows the problem to be in the "Sending data" step:
      10.5: Duration: 0.00146 seconds
      10.6: Duration: 0.010226 seconds

      Queries such as this:

      INSERT IGNORE INTO LegArg ( LegHdl, ID, NumVal, StrVal ) 
      SELECT LegHdl,10005,19388,'gDRRVDkky9PfbYTAkmVzDNWPZyZM1S63qxivoXaMBK53FfcsxjKMl2yFBX6iyYjs' 
      FROM Leg 
      WHERE LHash=x'00013A942AE53E7279946CBC428FF7B815867A39'
      ;
      

      ...when executed several thousand times, as in normal ingest jobs, result in an overall execution time 3,750% slower on average in MariaDB 10.6 than 10.5. Here's some timing results:

      10.5.27:
       839KiB 0:00:00 [1.90MiB/s]
      real	0m0.586s
       
       839KiB 0:00:00 [1.77MiB/s]
      real	0m0.617s
       
       839KiB 0:00:00 [1.94MiB/s]
      real	0m0.566s
       
       839KiB 0:00:00 [2.02MiB/s]
      real	0m0.531s
       
      10.6.20:
       870KiB 0:00:19 [45.7KiB/s]
      real	0m20.167s
       
       870KiB 0:00:19 [45.6KiB/s]
      real	0m20.215s
       
       870KiB 0:00:17 [48.4KiB/s]
      real	0m19.096s
       
       870KiB 0:00:19 [45.6KiB/s]
      real	0m20.262s
      

      By contrast, separating the operation out so that SELECTS populate a temporary table and then the INSERT is done directly from the temporary table with no selective predicate results in comparable performance in 10.6.20:

      create temporary table tLegArg like LegArg;
      INSERT IGNORE INTO tLegArg ( LegHdl, ID, NumVal, StrVal ) SELECT `LegHdl`,10003,51944,NULL FROM `Leg` WHERE `LHash`=x'e5d701b83032f1dd2551e230adee7f0b5721d86b';
      INSERT IGNORE INTO LegArg select * from tLegArg;
       
       839KiB 0:00:00 [2.02MiB/s]
      real	0m0.557s
       
       839KiB 0:00:00 [1.98MiB/s]
      real	0m0.577s
       
       839KiB 0:00:00 [1.92MiB/s]
      real	0m0.577s
       
       839KiB 0:00:00 [2.02MiB/s]
      real	0m0.556s
      

      The problem appears in all minor releases of 10.6, and persists in 10.11.10. However, 11.4.4 is not affected by the regression.

      To reproduce see internal comments.

      Attachments

        1. 10.6.21.7z
          21 kB
          Alice Sherepa
        2. db-uk-server.cnf
          0.6 kB
          Oleg Smirnov
        3. global_status_10.5.out
          14 kB
          Oleg Smirnov
        4. global_status_10.6.out
          14 kB
          Oleg Smirnov
        5. hdd_10.6_fsync.svg
          645 kB
          Axel Schwenke
        6. hdd_10.6_O_DIRECT.svg
          615 kB
          Axel Schwenke
        7. perf-10.5.svg
          386 kB
          Marko Mäkelä
        8. perf-10.6.svg
          396 kB
          Marko Mäkelä

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              juan.vera Juan
              Votes:
              1 Vote for this issue
              Watchers:
              15 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.