[TYPO3-dev] Typo3 Performance
R. van Twisk
typo3 at rvt.dds.nl
Fri Mar 2 17:34:57 CET 2007
Dmitry Dulepov wrote:
> Hi!
>
> Martin Kutschker wrote:
>
>> Can you explain this model in short or give me a pointer to an online
>> resource?
>>
>
> This model was proposed by Oracle DB expert Joe Celko. Generally it
> marks branches of the tree with consecutive numbers so that when you
> want to fetch root path or get the whole branch, you just need to issue
> query with two numbers. Example:
>
> |- C (3,4)
> |- B (2, 7)-|
> A(1,14)-| |- D (5,6)
> | |
> |- E (8,13)-|- F (9,10)
> |
> |- G (11,12)
>
> For example, to get a root line of F, exec this simple sql:
>
> select t2.uid from table t2, table t1 where t1.num1 between t2.num1 and
> t2.num2 and t1.num1=9
>
> Here num1 is the first number (i.e. 1 for A) and num2 is the second (14
> for A).
>
> That's all. Now imagine if you have index that consists from
> (uid,num1,num2)...
>
> Celko's article:
> http://www.intelligententerprise.com/001020/celko.jhtml?_requestid=235427
>
>
I happen to have a simple function that can can update the nested set
model from the
adjacency tree model.
So we can use the current methods and simply add the left/right nodes to
the tree.
The above version of the nested set model is resource expensive when
nodes are added/removed.
There is also a 'gap' version which reserves space to add nodes without
adding
a lot of overhead to updating the whole nested set.
Currently my function simply updates the whole tree when a change is made,
I could easily change it and hook it into TCEMain and add a left/right
node to the page tree.
When pages are only moved around from the BE I think it still will work
'ok' but
not effectively up until a couple of 1000 pages.
I have one site with 2000 pages, I could try it on there how long a
update would take.
Ries
More information about the TYPO3-dev
mailing list