Search Postgresql Archives

Re: DAGs and recursive queries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Jeff Davis" <pgsql@xxxxxxxxxxx> writes:

> On Wed, 2007-09-26 at 16:54 +0100, Gregory Stark wrote:
>
>> You could check out the tablefunc contrib which includes a function called
>> connectby() which implements a kind of recursive query.
>> 
>> Alternatively you might look at the ltree contrib module but that doesn't work
>> the way you describe. It denormalizes the data for very fast but less flexible
>
> Ltree seems like it might be a good option for him. What doesn't it do
> that he needs?
...
> Also, how exactly is the database denormalized by using ltree?

It keeps the same information in more than one place. Consider:

1
1.1
1.1.1

Note that all three records contain the root's id of "1". If you want to
reparent 1.1 to be 2.1 you have to know that all its children also need to be
reparented as well.

That's what he said he wanted to be able to do. In general if you have a
relatively static hierarchy something like ltree works very well but if you
have a very dynamic hierarchy where nodes move around freely it's not a very
good fit.


-- 
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux