We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [tree]

Trees are special cases of graphs. They are acyclic i.e. there is at most one path from any node to any other node. Typical uses include hierarchical data (parent-child relationships; roll-up aggregate values) and BTree indexes.

14 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
0answers
1k views

Working on a decision tree database design

I'm doing the conceptual model for a Decision tree database. The goal is store any Decision tree. I have four entity types: DecisionTree, Node, Branch and Leaf. Each Decision tree is composed of ...
2
votes
1answer
47 views

How to Store Trees on Disk

I am wondering how to store trees on a physical disk, for perhaps a tree-oriented database like an XML database. Wikipedia states about XML databases: ...custom optimized data structures are used ...
2
votes
0answers
370 views

Retrieve all product from one category (tree model)

I'm using MySQL, have categories in a tree model. One product belongs to only one (leaf) category. What I want to accomplish is, given one category (any, could or not be a leaf or a root), return ...
2
votes
0answers
207 views

Building a tree in Apache Derby 10.10

I know this question has been asked probably a million times, so please forgive me asking it again. I am not a DBA and have very little knowledge of SQL and Derby, but need some kind of a solution as ...
1
vote
1answer
122 views

Hierarchical / tree data - which type of database to use & design?

For querying (and writing to) a hierarchical structure (like a folder containing files and other folders, up to n levels deep, where n is pretty small, probably around 10, and there would be lots of ...
1
vote
0answers
62 views

Scalable way to manage aggregated statistics over time in hierarchy?

I'm using a closure table (Postgres through Django) to roll up stats through a hierarchical tree. When a node that is 10 layers deep has a value that increases, each parent's sum total of that value ...
1
vote
0answers
52 views

Nested set model in higher dimensions

The nested set structure is well-known and involves using left and right values to denote the relative heirarchy of nodes on one axis. Is there a generalization of this structure to higher dimensions?...
0
votes
0answers
23 views

How to UPSERT tree in PostgreSQL?

There is a tree-structures in two-tables with ParentId field. How to make UPSERT (INSERT ... ON CONFLICT (...) DO UPDATE ...) between them? The problem is that parent record for the current record in ...
0
votes
1answer
45 views

PostgreSQL, Stored Procedures, Recursive call Tree structure

I'm faced with a problem.I have a ternary structured data. The relation is from child to parent, more specific a child has an parent_id. A parent shouldn't have more than 3 children. When 4th child ...
0
votes
1answer
37 views

Optimizing one-way syncing of large (wide) tree

I deal with several trees that can vary in size (they all have depths of ~8-10) but it's not unusual for them to consist of ~50-100k nodes. At the moment, the trees are stored using simple parent_id ...
0
votes
0answers
18 views

Using LTREE type when the final node has ~1000 descendants, which exist under other final nodes

Is it inappropriate to use LTREE type when the final node has ~1000 descendants, which exist under other final nodes? My data is essentially a directory tree, with the final level containing text ...
0
votes
0answers
20 views

How does query parameters work under the hood?

I thought about how can it work under the hood and I came with an idea Db engine receives query with parameters and also defined values of those parameters SQL is being parsed into syntax tree like ...
0
votes
1answer
120 views

Bypass truncated data type error in `CREATE TABLE AS`

I am attempting to recreate the code from this excellent tutorial in MariaDB 10.2 to try and build nested sets from an existing adjacency list. (The goal being to ingest changes to the adjacency list ...
-3
votes
1answer
793 views

MySql - Get all child categories until not exists

Based on this answer, can you please tell me what's wrong in the next code ? I'm trying to get all child categories. The example that I try it is: DELIMITER $$ DROP FUNCTION IF EXISTS `...