Is there some facility in Hibernate for viewing the query plan for a query? I can look at the source code and trace the joins and eager fetches and hope that I don't miss any, or I can look at the SQL log and try to match up a SQL statement with its source, but I was wondering if there was a faster way. e.g., I can imagine an object diagram showing the relevant classes or an E-R diagram with some kind of sequencing notation.
Many times the underlying database engine will show you the plan. If you have the SQL queries being produced by Hibernate, you can prepend it with EXPLAIN
EXPLAIN SELECT blah blah blah
I'm using MySql on Linux so I can get this output without having to go through the Hibernate SQL output - I run mytop and hit 'e' when I see the query I'm interested in. I expect most database servers offer similar diagnostics.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With