Question : I’m trying to use CTE recursion. This is my scenario SQL Fiddle. It is a simple tree structure: […]
Tag: recursive
Can EXPLAIN be used to get some insights about Common Table Expression (CTE)?
Question : I need to find the ancestors in a table having an ID value and a Google research point […]
SQL recursion and cte – dates timeseries
Question : I need to build vector(s) of time series dates (say 10) for a subset of start dates. The […]
Social network comments and posts model in PostgreSQL 9.6
Question : I’m trying to figure out a data structure for migrating from MongoDB to PostgreSQL. Within my posts table […]
CTE: Get all parents and all children in one statement
Question : I have this working CTE example. I can select all grand-parents and all children. But how can I […]
postgresql Recursive Update resulting in Sequential Scan
Question : I have a table with a self-referential foreign key, and I would like to update a given parent, […]
Finding earliest connected value over two columns
Question : I have a, perhaps slightly esoteric, use case. Given a table like the following: id1 | id2 | […]
Recursive Parent-Child Location Relationship Cache as View
Question : Here is my data structure: CREATE TABLE Locations( LocID int IDENTITY(1,1) NOT NULL, LocationTypeID int NOT NULL, ParentID […]
How to use a recursive CTE to get ancestors in a hierarchy
Question : create table division ( id serial primary key, name varchar not null ); — nested sets table create […]
Grouping by overlapping arrays, transitively, without duplicates
Question : I’ve found: Group by array overlapping https://stackoverflow.com/a/23650080/5419599 However, I’m having trouble putting it to use in my case. […]