Subject | SELECT FIRST issue |
---|---|
Author | Juan Pedro López |
Post date | 2007-07-04T16:50:41Z |
I have coded the following loop:
Execute a sql query like:
SELECT FIRST x something FROM some tables
WHERE a condition happens
Iterate through the ResultSet and change in database the satisfied
condition in the executed query, so that next loop iteration will throw
different results.
Loop is finished when the executed query doesn't have any results.
This query is quite fast at every loop iteration but when there are less
results than the x value set in SELECT FIRST x clause.
For example the first time this query is executed, as there are enough
records in database which would match the WHERE condition, response time
is just a few miliseconds.
The last two executions (remember the last one is to detect there are no
more results in order to finish the main loop), as there are less than
'x' records in database which would match the WHERE condition, response
time is bigger, more than one second.
As this loop is executed lots of times, this increased response time is
quite significant in my application performance.
Does anybody know what could be happening?
I'm using Firebird 2.0.1 SS with Jaybird 2.1.1 on a Linux machine.
Thank you very much,
Juan Pedro López
Execute a sql query like:
SELECT FIRST x something FROM some tables
WHERE a condition happens
Iterate through the ResultSet and change in database the satisfied
condition in the executed query, so that next loop iteration will throw
different results.
Loop is finished when the executed query doesn't have any results.
This query is quite fast at every loop iteration but when there are less
results than the x value set in SELECT FIRST x clause.
For example the first time this query is executed, as there are enough
records in database which would match the WHERE condition, response time
is just a few miliseconds.
The last two executions (remember the last one is to detect there are no
more results in order to finish the main loop), as there are less than
'x' records in database which would match the WHERE condition, response
time is bigger, more than one second.
As this loop is executed lots of times, this increased response time is
quite significant in my application performance.
Does anybody know what could be happening?
I'm using Firebird 2.0.1 SS with Jaybird 2.1.1 on a Linux machine.
Thank you very much,
Juan Pedro López