Skip site navigation (1) Skip section navigation (2)

Re: Schema design question

From: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
To: Ben <bench(at)silentmedia(dot)com>
Cc: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: Schema design question
Date: 2008-03-31 07:38:48
Message-ID: 47F09508.7070707@cheapcomplexdevices.com (view raw or flat)
Thread:
Lists: pgsql-general
Ben wrote:
> I'm working on a project which requires me to keep track of objects, 
> each of which can have an arbitrary number of attributes. Although there 
> will be many attributes that an object can have,...
> Anyway, this seems like a common problem without a perfect solution, and 
> I'm sure people must have hindsight opinions on how they solved it. Your 
> thoughts?

If each attribute can only occur once for any object, and if your
queries are based more on exact matches of the values rather than
range queries, you might want to look into the hstore module:
http://www.postgresql.org/docs/current/static/hstore.html

If attributes can occur more than once, you might even want to
serialize the whole object as some text format (yaml, xml, etc)
instead.





In response to

pgsql-general by date

Next:From: Stuart BrooksDate: 2008-03-31 08:03:23
Subject: ANALYZE getting dead tuple count hopelessly wrong
Previous:From: Allan KamauDate: 2008-03-31 07:35:47
Subject: Removing redundant itemsets

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group