transitive-closure-table Questions

4

I have the following DAG A --> B | | v v C --> D Here is the closure table | Ancestor | Descendant | Depth | --------------------------------- | A | A | 0 | | A | B | 1 | | A | C | 1 | ...

2

Solved

How would I go about populating a closure table's depth/length column when inserting a new node to the tree? The values in ancestor and descendant are IDs from another table that represent pages t...
Refusal asked 12/4, 2014 at 13:3

1

I am having some difficulty wrapping my mind around SQL closure tables, and would like some assistance in understanding some of the examples I have found. Lets say I have a table called sample_ite...

1

Solved

This question How to store tree structure in sql? lead to the idea of a Closure table for storing trees that is optimal in many ways. The question is is there something along these lines for gr...
Combustor asked 6/4, 2018 at 20:9

3

Solved

Note: with help from RhodiumToad on #postgresql, I've arrived at a solution, which I posted as answer. If anyone can improve on this, please chime in! I have not been able to adapt a previous recu...
Turfman asked 9/9, 2014 at 22:11

3

Solved

I have a database containing a hierarchy of categories stored using the adjacency list model. The hierarchy is 3 levels deep (not including an imaginary root node) and contains approx 1700 nodes....
Defant asked 27/9, 2012 at 12:54

1

Solved

I'm using PostgreSQL 9.1 to query hierarchical tree-structured data, consisting of edges (or elements) with connections to nodes. The data are actually for stream networks, but I've abstracted the ...

1

I'm trying to model data that's organised as a hierarchical tree using a closure table. The entries that will represent nodes in the tree are nothing fancy and are defined as follows. class Regio...
Particia asked 9/2, 2013 at 14:18

1

I want to implement hierarchical data structure (e.g Product --> Product 2 ----> Product3, Product 2----> Product4) using entity framework 6 code first approach. There are several approaches availa...

3

Solved

I have a DAG in my relational database (Firebird) with two tables edge and node (adjacency list model). I want to query them recursively, but found recursive queries very inefficient. So I tried to...

2

Solved

[previous question] I'm trying to add reddit-like comments to an app, and I decided to go with the closure table pattern for database organization. My app database looks somewhat like this: posts...
Reinertson asked 17/4, 2013 at 20:38

2

Solved

I've created a simple example to illustrate transitive closure using recursive queries in PostgreSQL. However, something is off with my recursive query. I'm not familiar with the syntax, yet, so th...

1

Solved

I'm referring Bill Karwin's presentation in order to implement a closure table which will help me manage hierarchies. Unfortunately, the presentation does not show how I could insert/update the Lev...

1

Solved

I have a set of hierarchical data being used in a SQL Server database. The data is stored with a guid as the primary key, and a parentGuid as a foreign key pointing to the objects immediate parent....

1

I have an app set up which has nested comments attached to posts. I decided to use the closure table method (slide 40) for the comments due to how cheap hard disk space is versus how easy it seems ...
Archi asked 17/4, 2013 at 16:8

1

Solved

I would like to ask you to help me with the problem with sorting of the hierarchical data structure stored as a closure table. I wanted to use this structure to store my website menu. Everything w...
Ibex asked 28/12, 2012 at 12:36

1

Solved

I'm storing some hierarchical data in MySQL. For various reasons, I've decided to use closure tables (instead of nested sets, adjacency lists, and the like). It's been working great for me so far, ...
Badgett asked 20/10, 2012 at 9:2

1

Solved

I have been going around in circles with this closure table for awhile. The problem I have is with the second occurrence of a descendant. I have instances of sub-categories that appear in more than...
Incongruous asked 20/8, 2012 at 22:45

4

I have the following problem: I am trying to discover all possible paths from source node (node_s) to target node (node_t). The format of the original table with graph edges is simple: | node_x |...

1

Solved

I have a MySQL database holding hierarchical data using the Closure Table method. A simple sample database create script follows the question. My issue at the moment is how do I pull data out of th...
Realpolitik asked 24/11, 2011 at 4:45

1

Solved

I'm trying to implement a system in MySQL to store hierarchical data. I've decided to go with the system implemented here as described by Bill Karwin starting on slide number 40. I'm trying to setu...
Debate asked 19/11, 2011 at 4:59

2

Solved

I'm starting on a new project that has some hierarchical data and I'm looking at all the options for storing that in a database at the moment. I am using PostgreSQL, which does allow recursive qu...

1

I've been reading about closure tables as a way of modeling hierarchies over SQL. Does [SQLAlchemy] have any built-in support for creating and traversing hierarchical collections of object instanc...
Overreach asked 7/9, 2011 at 20:44

4

Solved

I have a table like this childid parentid ------------------------ 1 0 2 1 3 2 4 2 5 3 6 4 7 0 8 7 9 8 10 1 If I give a childid as 5, the parentid will be 1(output) If I give a childid as 9, th...
Buroker asked 9/7, 2009 at 16:24
1

© 2022 - 2024 — McMap. All rights reserved.