Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: rs.next() is slow
"Jochen Wiedmann" <jochen.wiedmann_at_softwareag.com> wrote in message
news:bphmta$1h9p$1_at_news.wplus.net...
>
> Hi,
>
> I have problems with the speed of a certain query. My first though was,
that
> the query itself is slow, but it turned out that the server replies quite
> quickly. Looking at the following code:
>
> logger.debug("Starting query"); int i = 0;
> ResultSet rs = stmt.executeQuery();
> try {
> for (;;) {
> logger.debug("Fetching result row " + i++);
> if (!rs.next()) break;
> logger.debug("Creating result object");
> ValueSet value = newValueSet();
> logger.debug("Filling result object");
> manager.fill(rs, value);
> logger.debug("Adding result object");
> result.add(value);
> }
> logger.debug("Done query");
>
> When the query is invoked, I find that the executeQuery() and the first 10
> iterations are executed immediately. However, when rs.next() is invoked
for
> the 11th time, I note a delay of some seconds (!). The same problem occurs
> when invoking rs.next() for the 21st, 31st, ... time.
>
> What is strange even more: The problem seems to depend on the machine. A
> colleague of mine receives a quick response.
>
> I am using Windows XP, Java 1.4.2_02, ojdbc14.jar, server version is
> unknown. Network adapter and CPU load are almost zero while the delay
> happens.
>
>
> Glad about any response,
>
> Jochen
>
Your fetch size is 10 rows.
Jim
Received on Thu Nov 20 2003 - 00:32:14 CST