Well, in my question at Stackoverflow, I explain.

Acctually the idea here is only a suggestion that may be helpful to the
delopment team. Like a report on a way to improve. I´m not familiar with
the Doctrine source code and from my point of view it should be only a
special case for isEmpty Collection method. If it's a EXTRA_LAZY
association then it could just get 1 record only and check with exists,
instead of fetching the whole collection as it is now or using count() > 0.
 In my tests to test isEmpty without fetching collection I obtained 243ms
using count(*) > 0 over 12ms of less using select exists(select id from
associatedTable WHERE mainId = [something] limit 1).
I tested this because what I want is ony to have a class property/method to
check if there are associated records or not.
If it's too complex, foget it then. Sorry :)

-Nelson

2014-07-18 12:11 GMT-03:00 Marco Pivetta

> Counting over an indexed association should be quite fast anyway.
>
> Are you sure there is an actual gain for introducing that much complexity?
>
> Marco Pivetta
>
> http://twitter.com/Ocramius
>
> http://ocramius.github.com/
>
>
> On Fri, Jul 18, 2014 at 5:08 PM, Nelson Teixeira <[email protected]>
> wrote:
>
>> Hello, based on this Stackoverflow question/answer:
>>
>>
>> http://stackoverflow.com/questions/24825047/doctrine-custom-form-field-based-on-query
>>
>> I would like to bring an ideia to the development team in using
>>
>> select exists(select * from associated_table where id_main_table =
>> <whatever> limit 1)
>>
>> in isEmpty() for EXTRA_LAZY associations.
>>
>> The current functionality is it would fetch the whole collection when
>> called.
>>
>> Based on my tests the performace gain on using it over count() > 0 would
>> be 20x faster.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "doctrine-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/doctrine-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "doctrine-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/doctrine-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to