last day (17 days later) » 

1:56 PM
1
Q: Jasper Reports 6.7.0 generating report is slow

SwapnilI'm using Jasper Reports 6.7.0 but reports generating so slowly. I'm generating report for only one record from the database but don't know why I'm getting poor performance. I've referred some questions from stack overflow but isn't helpful JasperReports fillReport too slow and resourc...

 
@huellif Have added SQL syntax. don't know if it is a cause of slowness.
 
@Swapnil: To check if the slowness is depended from your SQL query, you can write a more simple query (without join or with only one row) and check the time to fill your report.
 
@JoeTaras Is it possible to fetch foreign key without joining ?
 
If you don't want to use JOIN you must use subquery for each field of followup table, but is more expensive about performance. If your JOIN is slow, check if you have added the correct indexes on your involved tables
 
Indexes? where and how to check them?
 
1:56 PM
Which DBMS are you using?
 
I'm using MySQL
 
Ok
to see your indexes on your table, you can write desc table_name
or click on your table and check the index in its tab
 
result is showing corresponding pk and fk on fields
 
Ok, so your index are right
but your query is slow?
 
yes
what should I do? I tried other answers but doesn't helpful
 
2:19 PM
Post your execution query plan
 
Let me check
 
ok
 
Well let me know when I'm retrieving data using hibernate then there's seems no delay. So what about jasper reports? Don't you think there should be delay with hibernate?
 
2:37 PM
it's possible, but hibernate resolve a query with under dbms, so if your query is slow with SQL, Hibernate don't make miracles
 
here is an output of extended select
EXPLAIN EXTENDED SELECT followup.patientid, followup.patientid IN (SELECT patient.age from patient) from followup\G
*************************** 1. row ***************************
id: 1
select_type: PRIMARY
table: followup
partitions: NULL
type: index
possible_keys: NULL
key: lnk_patient_followup
key_len: 4
ref: NULL
rows: 11
filtered: 100.00
Extra: Using index
*************************** 2. row ***************************
id: 2
select_type: DEPENDENT SUBQUERY
table: patient
partitions: NULL
type: ALL
 
But this query: SELECT followup.patientid, followup.patientid IN (SELECT patient.age from patient) from followup
is not the query of your question
IN is very slow
you can substitute with exists
but this query is very different from your question
 
you sent me a link which is about optimization of database and tables.
I'm not getting exact reason of slowness.
 
yes, but every query has its history and meanings
your posted chat query is wrong about syntax (but MySql runs always :D ) and is very slow
so I don't understand how you link patiendid and its age
a possible right query will be:
SELECT followup.patientid, followup.patientid
FROM followup
WHERE EXISTS (
SELECT patient.age from patient
WHERE patient.patientid = followup.patientid)
but the exists in this case is pleonastic, because patient is a parent table of followup
so you are sure the patientid is always existing
to further indagate about slowness of your quey, you must to explain an execution query plan of your query
 
2:53 PM
is explain change the behavior of query execution when I will retrieve from anything I want like hibernate or jasper reports?
 
I can explain in theoric line the correct behaviour (i.e. use of indexes, prefer exists clause instead in clause, and so on)
but you have clear your aim
and you know well yout table structure
so nobody can help you
 
My aim is to optimize jasper report speed which is delaying so much.
But I'm not getting exact reason of delay
 
Yes, your aim about data to show
In your question query you'll show data about patient and followup table
it's right?
maybe you want to show data only one of these table?
My dear, now I'm going to home
bye
 
No I want to show data from both of tables cause there's Foreign_KEY is used
OK
Have a nice time ahead
Thank you for the attention
 

  last day (17 days later) »