Lists: | pgsql-general |
---|
From: | Cultural Sublimation <cultural_sublimation(at)yahoo(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Common table expressions and threaded comments |
Date: | 2009-04-17 12:40:22 |
Message-ID: | 19850.44178.qm@web63407.mail.re1.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Greetings,
I need to implement the classical problem of threaded comments in a Postgresql
database. I know that the upcoming 8.4 release includes Common Table
Expressions, so I have to ask: is this feature the mother-of-all-solutions
to the threaded comments problem, or is it still worth investigating ltree?
Also, lots of people mention Joe Celko's book on this subject. Is it still
a valid resource, or do CTE's make it obsolete?
Thank you!
C.S.
From: | Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com> |
---|---|
To: | cultural_sublimation(at)yahoo(dot)com |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Common table expressions and threaded comments |
Date: | 2009-04-17 12:53:35 |
Message-ID: | 2f4958ff0904170553o554a8059j370132db83701ffa@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On Fri, Apr 17, 2009 at 1:40 PM, Cultural Sublimation
<cultural_sublimation(at)yahoo(dot)com> wrote:
>
> Greetings,
>
> I need to implement the classical problem of threaded comments in a Postgresql
> database. I know that the upcoming 8.4 release includes Common Table
> Expressions, so I have to ask: is this feature the mother-of-all-solutions
> to the threaded comments problem, or is it still worth investigating ltree?
>
> Also, lots of people mention Joe Celko's book on this subject. Is it still
> a valid resource, or do CTE's make it obsolete?
Depending on what you actually need, but yes - CTE is the solution,
depending obviously on your schema design...
I think David (Fetter) had some examples in his slides on how to solve
common problems like that in a query.
--
GJ
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | cultural_sublimation(at)yahoo(dot)com |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Common table expressions and threaded comments |
Date: | 2009-04-17 14:24:39 |
Message-ID: | 20469.1239978279@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Cultural Sublimation <cultural_sublimation(at)yahoo(dot)com> writes:
> I need to implement the classical problem of threaded comments in a Postgresql
> database. I know that the upcoming 8.4 release includes Common Table
> Expressions, so I have to ask: is this feature the mother-of-all-solutions
> to the threaded comments problem, or is it still worth investigating ltree?
I don't think you should take CTEs as being the be-all and end-all of
solutions in this area (or any other). In particular I'd be suspicious
about the performance of a CTE-based solution. CTEs are new in 8.4 and
we have done essentially zero optimization work on them. I honestly
doubt if they will be able to match the performance of a single-purpose
solution such as ltree, even after a few years of optimization work.
regards, tom lane
From: | Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | cultural_sublimation(at)yahoo(dot)com, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Common table expressions and threaded comments |
Date: | 2009-04-17 22:34:46 |
Message-ID: | 2f4958ff0904171534y2f04407cvaa8b8366f4b050d7@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
I can only say for my own little experience. Features like that, allow
users to exchange less (none?) data between app and pg.
That's the main advantage of CTE.