Re: For the SQL gurus out there

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org, "Uwe C(dot) Schroeder" <uwe(at)oss4u(dot)com>
Subject: Re: For the SQL gurus out there
Date: 2007-12-13 11:06:12
Message-ID: 148225.11558.qm@web31808.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

--- On Wed, 12/12/07, Uwe C. Schroeder <uwe(at)oss4u(dot)com> wrote:

> The comments table also has a field that holds a
> self-reference to comment id
> for commments on comments (on comments) of a blog.

The model that you are referring to here is the adjacency list hierarchy model. There are two other models that will give you what you want but are harder to implement: path enumeration model and the nested set model. My guess is that the path enumeration model with give you what to want with a decent insert performance. Aside from this there is the ltree contribe module that take care of a lot of the work for you.

> What I would like to do is to create a view that sucks the
> comments for a
> given blog_id in the order they should be displayed (very
> commonly seen in
> pretty much all blogging apps), i.e.

Yup that is the problem with the adjacency list model.

Regards,
Richard Broersma Jr.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ow Mun Heng 2007-12-13 11:06:55 Need to find out which process is hitting hda
Previous Message Gregory Stark 2007-12-13 11:03:13 Re: [GENERAL] Slow PITR restore