cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aristedes Maniatis <...@maniatis.org>
Subject Re: Third prefetch kind - DISJOINT_BY_ID
Date Mon, 30 Jan 2012 10:12:47 GMT
On 30/01/12 8:21 PM, Andrus Adamchik wrote:
>
> On Jan 30, 2012, at 12:13 PM, Aristedes Maniatis wrote:
>
>> Isn't this just a bug in the old DISJOINT approach rather than a new type of prefetch?
What is the use-case for fetching all related records in the database when you have a fetch
limit?
>
> This is not a bug, rather a limitation of the algorithm. DISJOINT approach is based on
the root query qualifier transposed for the related entity. It has no way of knowing which
root objects will get below the fetch limit.
>
> Root:
>
>   SELECT * FROM ARTIST WHERE ARTIST_NAME LIKE 'X%' FETCH LIMIT 10;
>
> Prefetch
>
>   SELECT PAINTING.* FROM PAINTING JOIN ARTIST ON (..) WHERE ARTIST.ARTIST_NAME LIKE 'X%'
FETCH LIMIT ????
>
> Andrus

And does DISJOINT map to:

   SELECT * FROM ARTIST WHERE ARTIST_NAME LIKE 'X%' FETCH LIMIT 10;
   SELECT * FROM PAINTING WHERE true;


Are you proposing this new join type be:

   SELECT * FROM ARTIST WHERE ARTIST_NAME LIKE 'X%' FETCH LIMIT 10;
   SELECT * FROM PAINTING WHERE ARTIST_ID IN (123, 124, ....)



Ari


-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Mime
View raw message