Please enable JavaScript.
Coggle requires JavaScript to display documents.
Design patterns of Databases - Coggle Diagram
Design patterns of Databases
Graph
Abstract strucutuers
Diagram of dots
Models some kind of flow or relationship
Trees
Hierarcises
Directed tree with extra properties (suborination, inheritance)
Adjecny List Model
Adding and updating elements is an easy operation, because just id and parent id should be specified
Removal is more complex because all childrens of a deleted nodes should be removed
There are not a lot of ways of of selecting data
Materialized Path
Stores the path from the root to each node as a string at the node
Adding and editing are complex than in the adjency pattern. To add an item, it should be get parents path to add to its ID
Changin the item is also difficlut because IDs should be recalculated for all children, both direct and indirect
Removal of itms doesn`t involve violation to tree data integrity. Descendants of the delted items are still inderect descendants of remote parents
Selection is the best part of the pattern. For the selection with simple queries can be used various amount of options
Connected grpahs
Every node is the root of subtree
Binary tree every two nodes are conntected only with one upper node
Connected graphs that has one less edge than it has nodes
Nested Sets Model
Adding and editing are extremly coastly operations because of recalculation of the IDs, and the number of neighbours, and then changing of the corresponded fields from neighburs and parents
Remove is as well coastly operation, again of recalculation of IDs
Selection is the great use of this pattern. It is simple to calculate ID, direct and indirect ways, of elements