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

set names effects performance significantly when compiling function

    XMLWordPrintable

Details

    Description

      Having a different character set when compiling a function can impact the performance of the function significantly.
      The function itself has the proper character sets for input parameters and the result.

      Have a look at the attached function. In the following sequence you would observe that the execution is almost 10 times slower for just 10000 invocation and the only difference is the character set set when compiling the function.

      root@lukav::/vagrant# mysql test --init-command='set names utf8mb4' < ./set_names_test.sql 
      root@lukav::/vagrant# time mysql test --init-command='set names utf8mb4' -e "SELECT set_names_test(CONCAT('a', seq)) from seq_1_to_10000" > /dev/null 
       
      real	0m0,190s
      user	0m0,007s
      sys	0m0,004s
       
       
      root@lukav::/vagrant# mysql test --init-command='set names utf8' < ./set_names_test.sql 
      root@lukav::/vagrant# time mysql test --init-command='set names utf8mb4' -e "SELECT set_names_test(CONCAT('a', seq)) from seq_1_to_10000" > /dev/null 
       
      real	0m8,008s
      user	0m0,000s
      sys	0m0,010s
      

      If this is expected behaviour it should be well documented, but I couldn't find anything on the subject.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              lukav Anton Avramov
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.