db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <tfisc...@apache.org>
Subject Re: LargeSelect and databases which do not support native limit/offset
Date Mon, 12 Sep 2005 06:06:45 GMT


On Mon, 12 Sep 2005, Scott Eade wrote:

>> Therefore I am inclined to follow the proposed solution and throw an
>> exception in the constructor of LargeSelect if the chosen DB does not
>> support native limit and offset.
>>         ...
>>
>> Are there any objections ? Is everybody ok with throwing a
>> RuntimeException, or would it be better to add the TorqueException to
>> the throws clause, possibly breaking people's code because
>> TorqueException is not caught ?
>
> My only comment would be that as a heavy user of LargeSelect, if I were
> to ever switch to a database that did not support limit and offset I
> could not easily produce an executing (though obviously poorly
> performing when it comes to LargeSelect) version of my application.
>
> I would prefer us to add an appropriately worded statement in the docs
> and javadocs highlighting the issue with a recommendation that it not be
> used for the affected databases.
>

The comment already exists, though maybe one could highlight it more.  The 
problem is that the performance is much poorer 
than it need be, because fetching one page at a time is exactly the thing 
you should not do if you do not have native limit/offset.

Thinking over it again, the real solution would be to fetch the whole 
memoryLinit at once and do the offset by hand if the database does not 
support native limit/offset. The bad thing is that I do not know the 
LargeSelect code and have not the time to do it at the moment (sigh).

>>
>> I would also guess that the problems with databases which do not
>> support native limit/offset have lead to the exclusion of the
>> LargeSelectTest from the runtimetest. Does anybody object to include
>> the LargeSelectTest and print an error but not execute the test if the
>> database dose not support native limit/offset ? Sample code would be
>>
>> public class LargeSelectTest extends BaseRuntimeTestCase
>> {
>>     ....
>>
>>     public void testLargeSelect() throws TorqueException
>>     {
>>         if (Torque.getDB(Torque.getDefaultDB()).getLimitStyle()
>>                 == DB.LIMIT_STYLE_NONE)
>>         {
>>             log.error("LargeSelect is known not to work for databases "
>>                     + "which do not support native limit/offset");
>>             return;
>>         }
>>
>>     ....
>>
>> If one adds this, the LargeSelectTest also runs for hsqldb which does
>> not support native limit/offset.
>
> Does the test case fail at present?

At the moment, the method LargeSelectTest.testLargeSelect() fails.

> If we continue to let the code code
> execute for the reason given above then the test case should at least be
> enabled to make sure that the simulated limit and offset are indeed
> compatible with the behaviour when the database supports them.
>

If we manage to do the limit/offset manually, one could take it out again.

             Thomas

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


Mime
View raw message