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

P_S functions STATEMENT_DIGEST_TEXT and STATEMENT_DIGEST are missing

Details

    Description

      In MySQL 8.0 the 2 functions STATEMENT_DIGEST_TEXT and STATEMENT_DIGEST where introduced. Those are pretty convenient if you want to do your own stuff related to the P_S.

      https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html#function_statement-digest

      Because MariaDB 10.6 is actively supporting P_S it would be nice to have those functions as well. Otherwise we always have to rely on MySQL 8.0 for some query reporting stuff.

      Attachments

        Issue Links

          Activity

            Productboard is not visible to me (or public). Is this intentional?

            oli Oli Sennhauser added a comment - Productboard is not visible to me (or public). Is this intentional?

            no, sorry, it was a mistake. somebody experimenting with a new plugin for a different jira project.

            serg Sergei Golubchik added a comment - no, sorry, it was a mistake. somebody experimenting with a new plugin for a different jira project.
            Aurelien_LEQUOY Aurélien LEQUOY added a comment - - edited

            https://mariadb.com/kb/en/performance-schema-digests/

            from documentation it's say it's a MD5, but in reality :

            MariaDB [performance_schema]> select DIGEST from performance_schema.events_statements_history_long where DIGEST_TEXT = 'BEGIN' limit 1;
            +----------------------------------+
            | DIGEST                           |
            +----------------------------------+
            | af3d08bb89469f5a9513b6ed0d370be2 |
            +----------------------------------+
            1 row in set (0,000 sec)
             
            MariaDB [performance_schema]> select md5('BEGIN');
            +----------------------------------+
            | md5('BEGIN')                     |
            +----------------------------------+
            | 19aad9f2fe3ce0023298ab83f7e75775 |
            +----------------------------------+
            1 row in set (0,000 sec)
            
            

            Why not just a simple md5 ?

            Aurelien_LEQUOY Aurélien LEQUOY added a comment - - edited https://mariadb.com/kb/en/performance-schema-digests/ from documentation it's say it's a MD5, but in reality : MariaDB [performance_schema]> select DIGEST from performance_schema.events_statements_history_long where DIGEST_TEXT = 'BEGIN' limit 1 ; +----------------------------------+ | DIGEST | +----------------------------------+ | af3d08bb89469f5a9513b6ed0d370be2 | +----------------------------------+ 1 row in set ( 0 , 000 sec)   MariaDB [performance_schema]> select md5( 'BEGIN' ); +----------------------------------+ | md5( 'BEGIN' ) | +----------------------------------+ | 19aad9f2fe3ce0023298ab83f7e75775 | +----------------------------------+ 1 row in set ( 0 , 000 sec) Why not just a simple md5 ?

            it's not an MD5 of the digest text. Thanks for pointing this out, I've corrected the manual.

            It is an MD5 of a sequence of parser tokens, for example "BEGIN" is 605 (in 11.0).

            serg Sergei Golubchik added a comment - it's not an MD5 of the digest text. Thanks for pointing this out, I've corrected the manual. It is an MD5 of a sequence of parser tokens, for example "BEGIN" is 605 (in 11.0).
            Aurelien_LEQUOY Aurélien LEQUOY added a comment - - edited

            Any chance to see these function soon ?

            Personnally I wait this, from several years ... (i pushed also to MySQL to make it).

            serg : I was looking for in code to implement mine but i could'nt find it, if any doc how we can obtain this hash or 32 char ?

            Any way to sponsor it, to make it more faster ?

            Aurelien_LEQUOY Aurélien LEQUOY added a comment - - edited Any chance to see these function soon ? Personnally I wait this, from several years ... (i pushed also to MySQL to make it). serg : I was looking for in code to implement mine but i could'nt find it, if any doc how we can obtain this hash or 32 char ? Any way to sponsor it, to make it more faster ?
            danblack Daniel Black added a comment -

            I previously started on https://github.com/grooverdan/mariadb-server/tree/bb-11.2-MDEV-26259-statement-digest-text-functions
            There's a bit of bitrot with server internal changes.
            I think I got stuck on the QueryArea bits

            danblack Daniel Black added a comment - I previously started on https://github.com/grooverdan/mariadb-server/tree/bb-11.2-MDEV-26259-statement-digest-text-functions There's a bit of bitrot with server internal changes. I think I got stuck on the QueryArea bits

            cannot be more easy to just make a md5 of DIGEST_TEXT for the DIGEST ?

            My point there is not be compatible with MySQL (but it's will be cool too), but it's to generate a DIGEST from any SQL query who can match DIGEST from :

            MariaDB [performance_schema]> select digest from events_statements_summary_by_digest limit 10;
            +----------------------------------+
            | digest                           |
            +----------------------------------+
            | 153f48d7f20b6ce1d6c3e631c990c546 |
            | db296076334ead5c3932920044cc898a |
            | 06a9a06b02d22fcfe55620ac6831c95d |
            | 3e792320abe794feb751ee2c9ebda05c |
            | 1d35f539eb71033e2c298447181b0691 |
            | ad0989917c0b0246de8156ce61efbe22 |
            | 4ebf82b1aa2b735274a823e171d433a4 |
            | 9642bb52ff394a507ea43763add7f0f6 |
            | 20ea9b2c591b12e5dc1bb1ec82bdf8dd |
            | b0072833b82025d35849042cf8560b62 |
            +----------------------------------+
            10 rows in set (0,000 sec)
            

            Aurelien_LEQUOY Aurélien LEQUOY added a comment - cannot be more easy to just make a md5 of DIGEST_TEXT for the DIGEST ? My point there is not be compatible with MySQL (but it's will be cool too), but it's to generate a DIGEST from any SQL query who can match DIGEST from : MariaDB [performance_schema]> select digest from events_statements_summary_by_digest limit 10 ; +----------------------------------+ | digest | +----------------------------------+ | 153f48d7f20b6ce1d6c3e631c990c546 | | db296076334ead5c3932920044cc898a | | 06a9a06b02d22fcfe55620ac6831c95d | | 3e792320abe794feb751ee2c9ebda05c | | 1d35f539eb71033e2c298447181b0691 | | ad0989917c0b0246de8156ce61efbe22 | | 4ebf82b1aa2b735274a823e171d433a4 | | 9642bb52ff394a507ea43763add7f0f6 | | 20ea9b2c591b12e5dc1bb1ec82bdf8dd | | b0072833b82025d35849042cf8560b62 | +----------------------------------+ 10 rows in set ( 0 , 000 sec)

            That's pretty cool !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

            I will be able to remove my MySQL server which was only used for that!

            Thanks Serguei =)

            Aurelien_LEQUOY Aurélien LEQUOY added a comment - That's pretty cool !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! I will be able to remove my MySQL server which was only used for that! Thanks Serguei =)

            People

              danblack Daniel Black
              oli Oli Sennhauser
              Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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