You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Sheldon Ross <sr...@simmgene.com> on 2009/10/21 23:43:22 UTC
QueryDataSet constructing takes forever
Hello,
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.
Anyone experience anything like this?
Thanks
--
Sheldon Ross
Software Development
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org
RE: QueryDataSet constructing takes forever
Posted by Thomas Fischer <fi...@seitenbau.net>.
> 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