using ltree with tree structured data

From: Uros <uros(at)sir-mag(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: using ltree with tree structured data
Date: 2004-09-27 14:32:38
Message-ID: 1601949014.20040927163238@sir-mag.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello!

I'm using ltree data type for about 1 or 2 years now. I wan't to here how
you people using this type and how your data is structured.

For example:

I use it for our directory service where I have some categories and entries
(classifieds). Right now I have 2 tables. One for categories with ltree
column and table for storing entries, wich have foreign key id_category.
path (ltree type) is generated from id_category, because we use non C
locale so I'm not possible to insert caption into path. So I have to make
same maping betwen id and caption.
I also otput some statistics like, number of entries in categories etc.
Unfortenetly this stats is generated with trigers, because on-the-fly was
to slow.

Today I was going thru documentation of ltree and find out that ltree can
index such count. I also tried and counting subcategories was very fast.
So my idea is to use ltree on both categories and entries.
But the problem is how to do this without duplicating path etc., what about
ids and how to distict betwen category and entry.

Here I would like to here from you, maybe some of you already acomplish
this.

--
Best regards,
Uros

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2004-09-27 14:38:14 Re: core dump on select
Previous Message Tom Lane 2004-09-27 14:30:09 Re: could not create socket for statistics collector: Protocol not supported