Im working an app using Postgres and spring-data-jpa. As part of the app Im trying to have it show both the statistics from Hibernate as well as the resulting queries. The point is to help educate devs about the impacts of various types of fetches, etc…
What I am noticing is that the number of distinct queries that show up in my logs if I use show_sql: true
and the results that show up in statistics.getQueries don’t align. Specifically the show_sql output has all of the queries used to fetch the associated entities, where getQueries only has 2 (one for retrieval of the main entity and one for a count as part of using pagination),
Can someone explain to me why getQueries doesn’t show all of the unique queries that need to be issued, but show_sql does? Why wouldn’t those 2 entries match?