I have defined 2 basic metrics in a jasper domain measure 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 ok 2nd 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 cheque The jasper query works but gets 1 million rows instead of 1 row and uses 30Mo in memory instead of 0.1