JDBC & Java executeQuery 20 times slower then TOAD
I have a problem fetching the result of some of my queries out of Oracle 10g2
If I run the query in TOAD it takes approx 1 sec to finish.
If I run the query (static or Prepared) it takes longer than 20 sec.
Some sample code of what I'm doing:
conn = (OracleConnection)DriverManager.getConnection(DB_CONNECTION_STRING + hostname + ":" + port + ":" + sid, DB_USER, DB_PASSWORD);
objects = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);
objectset = objects.executeQuery(query);
Eventually my program is shutdown by a scheduler because it was running to long (>10 sec while it should run approx 1,5 sec).
TOAD Plan on query:
2 SORT AGGREGATE Bytes: 27 Cardinality: 1
1 TABLE ACCESS FULL TABLE TOMEASUREMENTGROUP Cost: 5,54 Bytes: 1.894.401 Cardinality: 70,163
Anyone experience with this?