1

I'm seeing a strange problem with perfromance_schema... it seems queries are not getting logged as I expect them to be. For example, this is what I get:

mysql> SELECT `SCHEMA_NAME`, `DIGEST_TEXT`, `COUNT_STAR`, `FIRST_SEEN`, `LAST_SEEN`
       FROM `performance_schema`.`events_statements_summary_by_digest`
       WHERE `DIGEST_TEXT` NOT IN ('COMMIT' , 'START TRANSACTION') 
           AND `DIGEST_TEXT` NOT LIKE 'SHOW %' 
           AND `SCHEMA_NAME` LIKE 'mydbase' 
           AND `DIGEST_TEXT` NOT LIKE 'SET %' 
           ORDER BY `LAST_SEEN` DESC LIMIT 5; 
+-------------+--------------------------------------------------------------------------------------------------------------------------
| SCHEMA_NAME | DIGEST_TEXT                                                    | COUNT_STAR | FIRST_SEEN          | LAST_SEEN           |  
+-------------+--------------------------------------------------------------------------------------------------------------------------
| mydbase     | SELECT `SCHEMA_NAME` , `DIGEST_TEXT` , `COUNT_STAR` , .......  |          6 | 2016-05-04 22:56:20 | 2016-05-04 22:56:42 |
| mydbase     | SELECT `st` . * FROM `performance_schema` . `events_statement`.|         39 | 2016-05-02 10:55:30 | 2016-05-04 16:06:48 |
| mydbase     | SELECT `st` . * FROM `performance_schema` . `events_stages_hi  |         39 | 2016-05-02 10:55:30 | 2016-05-04 16:06:48 |
| mydbase     | SELECT `st` . * FROM `performance_schema` . `events_waits_his  |         39 | 2016-05-02 10:55:30 | 2016-05-04 16:06:48 |
+-------------+--------------------------------------------------------------------------------------------------------------------------
5 rows in set (0.00 sec)

If I run the query inside the database from mysql client (CLI), I can see queries appearing in there, but those from the actual application are missing?

I'm running MySQL 5.6.30 from IUS repository (CentOS 6).

Any ideas?

2
  • If you remove the WHERE clauses and LIMIT, do you see your query?
    – Rick James
    May 5, 2016 at 5:00
  • No, I don't see them :-/ May 6, 2016 at 23:39

1 Answer 1

2

P_S in MySQL versions below 5.7.4 doesn't collect information regarding executed prepared statements: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-4.html.

Maybe your application is using prepared statements instead of simple ad-hoc statements (parameters concatenated). Some client libraries, like PHP's PDO can avoid this (MySQL's) issue by emulating prepared statements in software, instead of sending them to MySQL for preparation (PDO option PDO::ATTR_EMULATE_PREPARES).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.