db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: QueryDataSet constructing takes forever
Date Thu, 22 Oct 2009 06:31:46 GMT
> The following code produces some interesting results in my system.
>
>             connection = Torque.getConnection(Torque.getDefaultDB());
>             PreparedStatement statement =
> connection.prepareStatement(dynamicQuery);
>             ResultSet set = statement.executeQuery();
>             long startTime = System.currentTimeMillis();
>             QueryDataSet dataSet = new QueryDataSet(set);
>             log.debug("DDAElapsed time="+ (System.currentTimeMillis() -
> startTime) + " ms");
>             return BasePeer.getSelectResults(dataSet);
>
> The actual elapsed time of the query is very small, but it seems to take
> a very long time to create the querydataset.
>
> 2009-10-21 15:37:06,969 [TP-Processor3] DEBUG
> org.simmental.datamods.utils.DirectDataAccessor - DDAElapsed time=133 ms
> 2009-10-21 15:37:06,970 [TP-Processor3] DEBUG
> org.simmental.datamods.om.AnmId - Elapsed time=140 ms
>
> The last is the total elapsed time, so It appears to me like it is
> taking ~ 7ms to do the query, but ~133 ms to construct the querydataset.

I have no idea how large your result set is, nor how the database driver
for your database handles this internally. The data is actually read by
java while iterating over the result set, i.e. while constructing the QDS.
No idea whether the db driver has the result set buffered or whether the
data is fetched "live" from the db. In the latter case, a large data set
plus a reasonably slow network can easily produce this result.
You can check the QueryDataset code by iterating over the result set and
reading the data manually, and then compare the execution times.

      Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message