Subject | Re: [firebird-support] Re: altering triggers from sp |
---|---|
Author | Dimitry Sibiryakov |
Post date | 2004-08-19T11:03:33Z |
On 19 Aug 2004 at 8:55, kaczy27 wrote:
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'.
of tree may be missed in some cases.
SY, Dimitry Sibiryakov.
>Can you clarify on that? I have the list of childs in my currentActually, I think about additional table - list of all descendant.
>tree-like table (select id where parent = x)
>example: four levels, thirty nodes[skip]
>1-+-3-+-5-+-7
>| | | +-8
>| | +-6-+-9
>| | +-10
>No, not so.
>id, child, grandchild
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 fewIt depends on calculations you want to perform. Nodes in the middle
>millions entries of artificial index - question: is it worthwhile?
of tree may be missed in some cases.
SY, Dimitry Sibiryakov.