Re: Using Ltree For Hierarchical Structures - Mailing list pgsql-sql

From Igor Neyman
Subject Re: Using Ltree For Hierarchical Structures
Date
Msg-id A76B25F2823E954C9E45E32FA49D70EC08F7BD26@mail.corp.perceptron.com
Whole thread Raw
In response to Re: Using Ltree For Hierarchical Structures  (Don Parris <parrisdc@gmail.com>)
Responses Re: Using Ltree For Hierarchical Structures
List pgsql-sql

From: Don Parris [mailto:parrisdc@gmail.com]
Sent: Tuesday, February 26, 2013 1:23 PM
To: Misa Simic
Cc: Igor Neyman; pgsql-sql@postgresql.org
Subject: Re: [SQL] Using Ltree For Hierarchical Structures

Hi Igor,
As Misa points out, my original design used 2 tables - category & line-items.  Either way it's two tables.    The
biggestdifference lies in the approach to summing line-items by various levels of category - with each branch of the
treehaving different levels. 
I cannot speak to performance, but understanding CTEs has been difficult for me.  Ltree is so much simpler.  I am
certainthere is a place for CTEs, but why torture myself trying to hash out a CTE when ltree makes the queries so much
easierto write? 


Don,

To answer this question...
Before I worked (mostly) with Oracle which has "connect by" construct to work with hierarchies.
So, when I switched to Postgres I was happy to find "connect_by" contrib. modul.
And with more recent PG versions, it was just natural transition from contrib. module to recursive CTEs.

Igor



pgsql-sql by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: Using Ltree For Hierarchical Structures
Next
From: Don Parris
Date:
Subject: Re: Using Ltree For Hierarchical Structures