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

Re: dynamic object creation

From: Indraneel Majumdar <indraneel(at)www(dot)cdfd(dot)org(dot)in>
To: Mark Volpe <volpe(dot)mark(at)epamail(dot)epa(dot)gov>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: dynamic object creation
Date: 2000-10-13 21:10:35
Message-ID: Pine.SGI.3.96.1001013140632.133473A-100000@www.cdfd.org.in (view raw or flat)
Thread:
Lists: pgsql-sql
Thanks, this is what I'm currently using and want to change from. This
table is taking a long time to insert data into and to extract. My
smallest table of this sort has 68000 rows. In comparison arrays are 10
times faster but lack the required tools to work with (especially for
multidimensional arrays, even after I have extended the operators in the
contrib section). Also I cannot put field names for individual columns of
an array.

\Indraneel

On Thu, 12 Oct 2000, Mark Volpe wrote:

> You may want to think about creating your table like this (for example):
> 
> CREATE TABLE data
> (
> 	key text,
> 	field_type char,
> 	value text
> );
> 
> CREATE UNIQUE INDEX data_key ON data(key, field_type, value);
> 
> So this way each "record" takes up several rows in the table, and each "field"
> can take up as many rows as you need. A table like this, with two columns
> being arrays:
> 
> key  | field1  | field2 
> -------------------------
> a    | [x,y,z] | [a,d,f]
> b    | [m,n]   | (NULL)
> 
> Can be represented like this instead:
> 
> key  | field_type | value
> -------------------------
> a    | 1          | x
> a    | 1          | y
> a    | 1          | z
> a    | 2          | a
> a    | 2          | d
> a    | 2          | f
> b    | 1          | m
> b    | 1          | n
> 
> 
> I'm not sure what your data looks like, but I hope this helps.
> 
> Mark
> 

/************************************************************************.
# Indraneel Majumdar                  ¡  E-mail: indraneel(at)123india(dot)com  #
# Bioinformatics Unit (EMBNET node),  ¡  URL: http://scorpius.iwarp.com  #
# Centre for DNA Fingerprinting and Diagnostics,                         #
# Hyderabad, India - 500076                                              #
`************************************************************************/


In response to

pgsql-sql by date

Next:From: Indraneel MajumdarDate: 2000-10-13 21:11:36
Subject: Re: dynamic object creation
Previous:From: Itai ZukermanDate: 2000-10-13 11:20:45
Subject: Operator Column

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