I try to look at our database performance problems by making a general EXPLAIN select (...) in our mysql database, however our software (written in JAVA) uses JPQL. I want to say that all queries use objects, and I would like to reproduce the mysql query in the same way as the one that JPA created (can this be done? I mean, at some point it will need to be converted to sql).
Can someone explain how I can translate this (JPQL) to sql query? Or even, tell me if there is a way to do EXPLAIN directly in JPA so that I can do some UTs for this task.
I know that there is a way to show queries directly on the console when starting UT, maybe I'll try to figure out how to install it, but I'm not sure if it displays its own query instead of the JPQL query.
Just to clearly indicate your purpose:
- Use EXPLAIN or something similar to indicate performance problems in the database.
- Applied technologies: JPA and MySql.
Some of the solutions I was thinking about (which I would like you guys to indicate how possible they are):
- Learn how JPQL is converted to SQL and use the old EXPLAIN method.
- Learn how to use EXPLAIN directly in JPA
- Track logs or MySql console (when starting my UT): (
Thanks, Flavio.
source share