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!

preguntada hace 9 meses134 visualizaciones
No hay respuestas

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas