![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi! There's a database with following tables: 1) transition closure - helper table that contains hierarchy description with columns: node_id,node_parent_id,node_level. 2) table nodes - a table of nodes, directories or whatever - simply members of hierarchy 3) table people - table containing users descriptions the problem is about connecting users with hierarchy in a way, that every user can have its own root directory. imagine it with file system. we have a directory, eg. "root". within this directory we have a number of subdirectories that contain other, more and more nested, directories ... now, we have another direcory, "users". In order to have user have his own root dir, we simply use aliases. for example "users/john" has two aliases "apples" and "buckets" that link to "root/apples" and "root/things/buckets". This is simple with file system, unfortuanetly i need to have an sql solution. I tried to add another table, ("people_root_contents") with column node_id,people_id that contained users root dir contents, but as you can easily imagine, the query for searching the whole user-dependant hierarchy was huge and slow. Any ideas? |
#3
| |||
| |||
|
|
How are you "searching the whole user-dependant hierarchy"? Are you using a recursive query? |
#4
| |||
| |||
|
|
Hi! There's a database with following tables: [...] now, we have another direcory, "users". In order to have user have his own root dir, we simply use aliases. for example "users/john" has two aliases "apples" and "buckets" that link to "root/apples" and "root/things/buckets". This is simple with file system, unfortuanetly i need to have an sql solution. |
|
I tried to add another table, ("people_root_contents") with column node_id,people_id that contained users root dir contents, but as you can easily imagine, the query for searching the whole user-dependant hierarchy was huge and slow. |
#5
| |||
| |||
|
|
Hi! There's a database with following tables: 1) transition closure - helper table that contains hierarchy description with columns: node_id,node_parent_id,node_level. 2) table nodes - a table of nodes, directories or whatever - simply members of hierarchy 3) table people - table containing users descriptions the problem is about connecting users with hierarchy in a way, that every user can have its own root directory. imagine it with file system. we have a directory, eg. "root". within this directory we have a number of subdirectories that contain other, more and more nested, directories ... now, we have another direcory, "users". In order to have user have his own root dir, we simply use aliases. for example "users/john" has two aliases "apples" and "buckets" that link to "root/apples" and "root/things/buckets". This is simple with file system, unfortuanetly i need to have an sql solution. I tried to add another table, ("people_root_contents") with column node_id,people_id that contained users root dir contents, but as you can easily imagine, the query for searching the whole user-dependant hierarchy was huge and slow. Any ideas? Regards H |
#6
| |||
| |||
|
|
Add a column "link_target" to your node table. If a node specifies a directory, its NULL, if it is a alias/symbolic link, then enter the link end node id there. Besides that, you could even merge your node and your hierarchy table. |
#7
| |||
| |||
|
|
Dont know if it is exactly what you are looking for but here is one attempt: http://fungus.teststation.com/~jon/t...eeHandling.htm It describes a way to add "crossgroups" to an hierarchical organisation. Usage could be to represent projects spanning over parts of an organisation, or to save results of queries, for later processing, etc. |
#8
| |||
| |||
|
#9
| |||
| |||
|
#10
| |||
| |||
|
|
hi, |
|
Hmm...it seems that what wrote earlier is similiar. Simply, in situation described in that document, you make a modified copy of "hierarchy description (transition closure contents)" for each link. That can take a lot of place and can be slow. |
|
--------------- The only solution that seems to be fast is to create another table, that contains all node_ids,their childs and all offsprings (like transition closure,but only for a "user-root" direcotory) so we can have fast "user-root-search" by joining that table and nodes table. --------------- |
![]() |
| Thread Tools | |
| Display Modes | |
| |