[TYPO3-mvc] findAll() with child objects performance

Adrien Crivelli adrien.crivelli at gmail.com
Wed Feb 1 02:21:05 CET 2012


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>
>


More information about the TYPO3-project-typo3v4mvc mailing list