-
Notifications
You must be signed in to change notification settings - Fork 933
QueryExecutionCount statistic does not count all queries #2714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It looks intentional to me. Query prefix here is not about any DB queries - but about loading via Query API. |
@bahusoid The current usage hides unexpected behavior as tests cannot verify the total number of queries actually executed against the database. |
Query Statistics are not about SQL queries as explained by bahusoid, but about NHibernate queries. A get or load is not a NHibernate query. Trying to use them for counting SQL queries cannot be reliable, they are just not meant for this. Changing them for counting SQL queries would corrupt its semantic, and would be a breaking change. |
@fredericDelaporte Yes, I understand. Maybe another metric should be added to measure/count all database queries executed? For the time being, I'll see if the other metrics capture the inconsistent behavior I'm seeing as suggested by @bahusoid. |
I would need to dig the code a bit to asses this, but maybe an interceptor or some events could allow you to get this kind of statistics. So no built-in way, but it may be an injection point allowing you to build the feature. |
When loading data from a session there are several cases where queries are executed without being counted in the QueryExecutionCount. E.g. The following code will cause the QueryExecutionCount to be incremented:
However, the following does NOT increment the QueryExecutionCount:
The implications of this issue is that tests which rely on this statistic are broken as the statistic does not accurately represent the number database queries executed.
The text was updated successfully, but these errors were encountered: