Subject Re: [firebird-support] Re: altering triggers from sp
Author Dimitry Sibiryakov
On 19 Aug 2004 at 8:55, kaczy27 wrote:

>Can you clarify on that? I have the list of childs in my current
>tree-like table (select id where parent = x)

Actually, I think about additional table - list of all descendant.

>example: four levels, thirty nodes
>1-+-3-+-5-+-7
>| | | +-8
>| | +-6-+-9
>| | +-10
[skip]
>
>id, child, grandchild

No, not so.

id, has_as_child
1 3
1 5
1 7
1 8
1 6
1 9
1 10
3 5
3 7
3 8
3 6
3 9
3 10
5 7
5 8
6 9
6 10
......

Then a sub-tree can be selected by simple (and fast) query:
'.... WHERE id=1'. Full branch from leaf to root - '... WHERE
has_as_child=10'.

>my one million records table would have to be matched with few
>millions entries of artificial index - question: is it worthwhile?

It depends on calculations you want to perform. Nodes in the middle
of tree may be missed in some cases.

SY, Dimitry Sibiryakov.