Re: Adjacency List or Nested Sets to model file system hierarchy?

From: "Ian Harding" <harding(dot)ian(at)gmail(dot)com>
To: "Bill Moseley" <moseley(at)hank(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Adjacency List or Nested Sets to model file system hierarchy?
Date: 2007-02-12 17:36:37
Message-ID: 725602300702120936k2395ab34n68c2132c5beb909e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2/12/07, Bill Moseley <moseley(at)hank(dot)org> wrote:
> I'm looking for a little guidance in representing a file system --
> well just the file and directory structure of a file system.
>
> Often articles on representing a hierarchy discuss the advantages of
> using Nested Sets (or nested intervals) it seems. I'm not clear how
> well they apply to a file system-like hierarchy, though.
>
> The examples (and my limited understanding) of Nested Sets have the
> leaf nodes at the end of the branches, where in a file system a node
> can have both leaf nodes (files) and branches (directories).
>
> Also, the Nested Sets seem to solve problems I don't have -- such as
> finding all descendants of a given node.
>
> My simple requirements are:
>
> -- Quickly be able to lookup content by a full "path" name
>
> -- Provide "directory" views that shows parent, list of contents
> including any "sub-directories".
>
> -- To be able to easily move branches.
>
> It will not be a large collection of "files" in the tree, so that's
> not an issue.
>

You don't mention the ltree contrib module, have you looked at it? It
can easily meet your requirements without having to reinvent anything.
It may be what you're referring to as Nested Sets, I don't know. I
use it and like it a lot.

-Ian

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tommy Gildseth 2007-02-12 18:09:52 Re: how to store whole XML file in database
Previous Message Merlin Moncure 2007-02-12 15:53:53 Re: Adjacency List or Nested Sets to model file system hierarchy?