[Hibernate-JIRA] Created: (HHH-3291) Hibernate QueryStatistics should permit keying by Named Query nickname when available
by Jim Doyle (JIRA)
Hibernate QueryStatistics should permit keying by Named Query nickname when available
-------------------------------------------------------------------------------------
Key: HHH-3291
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3291
Project: Hibernate3
Issue Type: Improvement
Affects Versions: 3.2.x
Environment: JBoss 4.2.2
Reporter: Jim Doyle
This request is related to the additional feature request HHH3289 for show_sql.
QueryStatistics are keyed by the full HQL query string. For monitoring and tuning persistence tier performance in midsize to large applications, it is more
convenient to store the Named Query name rather than the full HQL such that the application developers can locate the named query in their annotated
core, or in orm.xml, and make the changes needed to conduct performance tuning.
I propose changing the mechanism that deposits query statistics:
use the Query Name for Named JPQL/HQL and Named Native Queries
prefix ad hoc native SQL queries with 'native;" and use that as the statistics key
use the existing HQL query string for all ad hoc HQL queries
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 10 months
[Hibernate-JIRA] Created: (HHH-3289) show_sql output should identify the Named Query associated with generated SQL output
by Jim Doyle (JIRA)
show_sql output should identify the Named Query associated with generated SQL output
------------------------------------------------------------------------------------
Key: HHH-3289
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3289
Project: Hibernate3
Issue Type: Improvement
Components: core
Affects Versions: 3.3.0
Reporter: Jim Doyle
It is useful to know which named query was at cause for generated SQL traffic in output logs. Medium sized applications can realistically employ a hundred named queries and it is extremely useful to known the ID of the named query as well as see the generated SQL.
This feature would very much improve the ability of DBAs to undertake performance tuning. In a typical use case, the DBA would cut and paste the
generated show_sql query directly in the the vendor database Explain tool to analyze performance. After manually tuning the query in the Explain analyzer,
changes to the JPQL or HQL can then be applied, deployed and tested again by looking at the generated SQL.
I propose changing the show_sql output to appear as follows:
10:21:04,397 INFO [STDOUT] Hibernate [MYsessionFactoryId] [MYnamedQueryName] : select top 5 pro0_.transactionID as transact2_27_, pro0_.date as date27_, pro0_.suffix_suffixCodeID as suffix40_27_, pro0_.creationDate as creation4_27_, ....
A String that identifies the Session Factory will be printed to disambiguate the originating SF that produced the SQL. This is necessary in environments where
more than one session factory is present (JBoss container, multiply deployed application in Tomcat). In such cases, it *MIGHT* be possible for two different session factories to have identically named named queries, so by printing an Id for the Session Factory, there is a means of resolving this when examing the output.
The Named Query identifier will only appear for Named Native or Named JPQL/HQL type queries. For ad-hoc queries, the brackets may be either empty
or not present to indicate that the generated SQL verbs originate from a source other than a named query.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 10 months