RDS Performance Insights doesn't seem to be recording TOP SQL stats for prepared statements

0

I am currently facing an issue where my TOP SQL stats are displayed as "-" for all my queries. I am using an Aurora Mysql 8.0.mysql_aurora.3.04.0 database.

After further investigation I came to the conclusion that this is only happening for prepared statements. I am using a NodeJS ORM for database communication which uses prepared statements for all their queries.

Reproducing this issue is easy:

  1. Call a prepared statement like the following:
PREPARE stmt_name FROM 'SELECT * FROM my_table WHERE column1 = ?';
SET @param_value = 'some_value';
EXECUTE stmt_name USING @param_value;
DEALLOCATE PREPARE stmt_name;
  1. Notice that the query FROM 'SELECT * FROM my_table WHERE column1 = ?' gets logged in performance insights but its stats are not set.
  2. Now execute the query without using a prepared statement:
SELECT * FROM my_table WHERE column1 = <value>
  1. Notice how the query gets logged in performance insights with the stats values present.

I suspect that this has something to do with the way mysql records performance data from prepared statements as they are not recorded in performance_schema.events_statements_summary_by_digest table but instead on performance_schema.prepared_statements_instances table. Maybe RDS Performance Insights is having some issues pulling the stats data from the latter.

Any help is greatly appreciated, thanks!

已提问 9 个月前134 查看次数
没有答案

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则