[TYPO3-dev] The extbase dilemma

Mathias Schreiber [wmdb] mathias.schreiber at wmdb.de
Fri May 20 13:26:03 CEST 2011


Am 20.05.11 12:43, schrieb Peter Niederlag:
> Hello,
>
> Am 20.05.2011 12:15, schrieb Mathias Schreiber [wmdb]:
>> Am 20.05.11 11:20, schrieb Peter Niederlag:
> [...]
>> If we stick to the blog example:
>> 100 blogs with 100 posts each and 100 comments per post.
>> You want to display the latest comment per blog.
>> IIRC this would result in at least 100 queries, right?
>> Or I fiddle around with custom queries which then in return does not let
>> me use persistence or does it?
>
> That's a very nice and perfect use case, also you most likely would only
> want to display the last 10 comments!
>
> I think this can probably not be done properly (without loading way to
> much data) via the current query implementation and does need some
> "Hirnschmalz"(brainpower). ;)
>
> I have solved a similar limitation via a trigger which saves the needed
> data (blog.latestComment, blog.lastCommentDate) in the blog table so I
> can easily query it. Code for the trigger is loaded via
> class.ext_update.php.

Ok, so basically like most forum software does. Redundant data.
Or I guess one could call it "cache".
This is not neccessarily a bad thing, as long as it is handled savely.
Triggers within the database are one of the things I suggested (as well 
as views etc.) but we clearly are outside of things extbase can know then.

> now you query 10 blogs by sorting via latestCommentDate-> Voila,
> performant solution. :->

But this has nothing to do with extbase :)

> Needs some knowledge but can "easily" be done. ;)

Well, I hope all devs know about the capabilities of their tools, 
otherwise we're knee-deep in trouble.
What get's me thinking is this (maybe Xavier can comment on this):
Since MySQL has matured over the last 10 years we still only use a tiny 
subset of its features.
Can someone explain to me why we don't use the full potential of the 
database?

I am totally fine with having the database take care of my data 
consistency instead of some PHP script.
Or in DDD-lingo: handling consistency is NOT the domain of a PHP script :)

-- 
Ernesto, Nov. 9th 2010:
"In the graphics generation routines of TYPO3 *anything* could cause a
side effect."




More information about the TYPO3-dev mailing list