paris11 Posted May 6, 2021 Share Posted May 6, 2021 I have defined 2 basic metrics in a jasper domainmeasure 1 : number of cheques = count (distinct cheque id)measure 2 : amount of cheques = sum (amount) 1st ad hoc view, I select the measure 1, here is the jasper query :select count(DISTINCT "cheque"."id_cheque") as "CountDistinct_cheque_id_cheque" from "public"."cheque" "cheque"that s ok2nd ad hoc view , I select measures 1 and 2, here is the jasper query :select Sum("cheque"."montant") as "Sum_cheque_montant", "cheque"."id_cheque" as "cheque_id_cheque"from "public"."cheque" "cheque"group by "cheque"."id_cheque" limit 2000001 Why the jasper query is not like that select count(distinct id_cheque),SUM(montant) from chequeThe jasper query works but gets 1 million rows instead of 1 row and uses 30Mo in memory instead of 0.1 Link to comment Share on other sites More sharing options...
paris11 Posted May 6, 2021 Author Share Posted May 6, 2021 https://community.jaspersoft.com/wiki/unexpected-results-andor-performance-issues-group-summaries-ad-hoc-v50-and-later I do not understand, it is already like that in applicationContext-adhoc-dataStrategy.xml<bean> <property name="name" value="DistinctCount" /> <property name="functionName" value="distinctCount" /> <property name="calcMethod" value="sqlUnionAll" /></bean> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now