Subject | Re-entrant Queries |
---|---|
Author | Lee Jenkins |
Post date | 2009-08-21T20:50:17Z |
Hi all,
I've read about this somewhere (maybe Helen's book) and I think Re-entrant query
is what I need.
I have a table:
Tourneys
OID: varchar
ParentOID: varchar
A Tourney can have "sub" tournaments (each could be part of a series tournament
or even satellite tournament into a larger one) and each of those tournaments
can have sub tournaments, etc.
1. Would anyone care to provide a simple example or pseudo code showing the
basic logic of such queries? For instance, off the top of my head I would
probably need a query that tested if a particular tournament's OID was already
present in it's parent's tournaments hirearchy, etc so that I don't add a
tournament farther from root using a tournament that was created closer to root.
2. What about performance with queries like these? I imagine that a recursive
Store Procedure could be hard put to handle very complex trees but I can't
imagine going more than 5 levels deep at any node but I guess that could be a
lot as well if some nodes hold many peer nodes.
Thanks for guidance,
--
Warm Regards,
Lee
I've read about this somewhere (maybe Helen's book) and I think Re-entrant query
is what I need.
I have a table:
Tourneys
OID: varchar
ParentOID: varchar
A Tourney can have "sub" tournaments (each could be part of a series tournament
or even satellite tournament into a larger one) and each of those tournaments
can have sub tournaments, etc.
1. Would anyone care to provide a simple example or pseudo code showing the
basic logic of such queries? For instance, off the top of my head I would
probably need a query that tested if a particular tournament's OID was already
present in it's parent's tournaments hirearchy, etc so that I don't add a
tournament farther from root using a tournament that was created closer to root.
2. What about performance with queries like these? I imagine that a recursive
Store Procedure could be hard put to handle very complex trees but I can't
imagine going more than 5 levels deep at any node but I guess that could be a
lot as well if some nodes hold many peer nodes.
Thanks for guidance,
--
Warm Regards,
Lee