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

Implement MySQL 8.0 native functions: format_bytes(), format_pico_time() and ps_thread_id()




      While this functions can be implemented as user SQL functions, they have become native on MySQL 8.0.16. They are simple and independent enough that backport them should be easy.
      Implementing them on MariaDB would allow:

      • Better compatibility with sys/performance_schema
      • Nice functions to have natively in any case for formatting reasons or even as a virtual column
      • Better MySQL compatibility, and avoiding user pain when migrating from MySQL from 8.0.16+
      • Better performance by being C rather than user functions/SQL


      MySQL implementation

      MariaDB implementation

      • MariaDB doesn't have any native functions
      • MariaDB has sys schema function format_bytes, as stated in sysschema.format_bytes documentation.
      • This change is introduced from 10.6.0 with commits and author

        commit aa2ff62082c4eb09b1d505af0d0327278c9f7d08
        Author: Vladislav Vaintroub <wlad@mariadb.com>
        Date:   Wed Mar 3 10:30:29 2021 +0100
            MDEV-9077 Use sys schema in bootstrapping, incl. mtr

        and second commit

        commit 4bac804c90c6f8d101ef32aef39813c3d13283ff
        Author: Vladislav Vaintroub <wlad@mariadb.com>
        Date:   Wed Mar 17 17:57:11 2021 +0100
            MDEV-9077 add sys_schema from https://github.com/mysql/mysql-sys

      • Tasks:
        The task can be divided into 3 steps by backporting the patch from MySQL if possible in single commit and if not in separate commits:
      • Create native function format_pico_time - task done as contribution with PR 2558 on 11.0, commit d9808f79
      • Create native function ps_thread_id
      • Create native function ps_current_thread_id
      • Create native function for format_bytes


        Issue Links



              anel Anel Husakovic
              jcrespo Jaime Crespo
              1 Vote for this issue
              6 Start watching this issue



                Git Integration

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