[TYPO3-mvc] findAll() with child objects performance
Daniel Schöne
daniel at schoene.it
Wed Feb 1 08:01:50 CET 2012
Hi Lorenz,
on top of lazy loading you might want to have a look @ the enetcache extension, with makes the caching framework available to extensions.
cheers,
daniel
On Feb 1, 2012, at 2:31 AM, Adrien Crivelli wrote:
> Uhm, I meant actually 1 + 200 * 20 queries. But that's still a lot...
>
> On 1 February 2012 10:21, Adrien Crivelli <adrien.crivelli at gmail.com> wrote:
>
>> Hi,
>>
>> In your case, you'll have at least 200 + 200 * 20 SQL queries executed.
>> This is a lot. Lazy loading would probably be your best bet to reduce
>> queries count if you don't always need those child objects. Cannot find
>> official documentation about it, but here is an example:
>>
>> http://forge.typo3.org/projects/extension-newsletter/repository/diff?rev=55991&type=sbs
>>
>> Good luck,
>>
>> Adrien
>>
>>
>> On 1 February 2012 06:18, Lorenz Ulrich <lorenz-typo3 at visol.ch> wrote:
>>
>>> Hi everyone
>>>
>>> During Extbase development some questions regarding performance raised up
>>> so I'm interested in how you handle certain things.
>>>
>>> If I have an object with relations to several child objects (an artist
>> has
>>> works, is member of a genre etc.) and I want to list all artists, I would
>>> normally use the findAll method from the repository, pass it to Fluid and
>>> use the For ViewHelper to iterate.
>>>
>>> This is very slow, even with only 200 people (but each of them having
>>> about 20 child objects). I assume it is because the object is fetched
>> with
>>> all its children and then passed to Fluid (where I only need some fields
>>> like name and uid).
>>>
>>> If I add a method to the repository and use $query->statement to fire a
>>> query that only fetches the fields I need, it is very fast.
>>>
>>> Is there a way to have better performance without using
>> $query->statement?
>>>
>>> Thanks and best regards,
>>>
>>> Lorenz
>>> ______________________________**_________________
>>> TYPO3-project-typo3v4mvc mailing list
>>> TYPO3-project-typo3v4mvc@**lists.typo3.org<
>> TYPO3-project-typo3v4mvc at lists.typo3.org>
>>> http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-**
>>> project-typo3v4mvc<
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc>
>>>
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>
--
Daniel Schöne
tel.: (0351) 25 38 138
mobil: (0178) 14 81 505
email: daniel at schoene.it
web: http://schoene.it
USt-IdNr.: DE 264 29 88 81
More information about the TYPO3-project-typo3v4mvc
mailing list