Quote:
I ran several tests with em.createNativeQuery, where I select 1000 records from a table in Oracle.
The query takes about 10s to finish.
The same query run in pl/sql developer takes about 2.0 seconds. This is a massive difference.
Does pl/sql developer also show the 1000 records within this 2.0 seconds?
I ask you this, because there are 2 different measures in querying which often are confound:
1. The first measure is the time which the database takes to execute the query and to build up the result set.
Some sql-tool show only this measure (for pl/sql developer I don't know how it behavior is)
2. The second measure is the time it takes to fetch the result-set from the database to your client.
On large result set the fetching of the data takes more time than building up the result set in the database engine.
In Hibernate the returned relational data must be transformed in java objects (OR-mapping) so this takes a little more time.
Consider also that the enabled Tracing itself consumes considerable time.
Quote:
As you see in the trace, there are delays of about 100ms. They appear always at the same place and always after 10 records.
This delays indeed are suspicious. Can it be that there are Full garbage collections starting each 10 seconds?
If not I suggest you to try to create some stack-traces while this delays (see jstack command),
and to look at this stacks. You can also report them here, so we can see together what the application right is doing
while this 100ms gaps.