Details
-
Task
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
None
Description
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
https://mysql.wisborg.dk/2019/05/28/performance-schema-functions/
MySQL implementation
- MySQL has native implementation of function:
1. format_bytes,
2. format_pico_time
3. ps_thread_id
4. ps_current_thread_id
- As well as sys schema defined functions [that are marked as deprecated and will be removed]:
1. format_bytes
2. ps_thread_id
3. format_time
- In MySQL all native functions are defined in file item_pfs_func.h, where source code declaration is item_pfs_func.cc . Definition of native functions format_pico_time for example is item_create.cc
- Commit and author that introduced native function is
commit 260e09ea654a9688f588c13f5303bcc34dfc4a7d
Author: Christopher Powers <chris.powers@oracle.com>
Date: Thu Dec 13 01:33:24 2018 +0100
WL#7803 Performance Schema, Native Functions
Added native functions:
ps_current_thread_id()
ps_thread_id()
format_bytes()
format_pico_time()
- Test are added to perfschema suite suite/perfschema/t/
1. native_func_format_time
2. native_func_format_bytes
3. native_func_thread_id
4. native_func_thread_id_no_ps
5. native_func_thread_id_null
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
Attachments
Issue Links
- includes
-
MDEV-31736 Create native function for format_bytes
- In Testing
- is part of
-
MDEV-28906 MySQL 8.0 desired compatibility
- Open
- relates to
-
MDEV-33703 Negative numbers and differnce of behaviour between sys.format_time() and FORMAT_PICO_TIME()
- Open
1.
|
Create native function format_pico_time | Closed | Anel Husakovic | |
2.
|
Create native function ps_thread_id | Open | Unassigned | |
3.
|
Create native function ps_current_thread_id | Open | Unassigned |