using ltree with tree structured data - Mailing list pgsql-general

From Uros
Subject using ltree with tree structured data
Date
Msg-id 1601949014.20040927163238@sir-mag.com
Whole thread Raw
List 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


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: could not create socket for statistics collector: Protocol not supported
Next
From: Andrew Sullivan
Date:
Subject: Re: core dump on select