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