pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Arrays - a good idea?
4+ messages / 4 participants
[nested] [flat]

* Arrays - a good idea?
@ 2003-11-18 22:05 Paul Ganainm <paulsnewsgroups@hotmail.com>
  2003-11-18 23:49 ` Re: Arrays - a good idea? Yasir Malik <ymalik@cs.stevens-tech.edu>
  0 siblings, 1 reply; 4+ messages in thread

From: Paul Ganainm @ 2003-11-18 22:05 UTC (permalink / raw)
  To: pgsql-sql



Hi all,


Even though PostgreSQL supports arrays, is it a good idea to use them? I 
mean, they

a) don't conform to the relational model

and 

b) are not transportable


so if one is designing an app, should one use them? 

When should they not/never be used? What are the criteria for justifying 
their use?


Paul...


-- 

plinehan__AT__yahoo__DOT__com

C++ Builder 5 SP1, Interbase 6.0.1.6 IBX 5.04 W2K Pro

Please do not top-post.




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Arrays - a good idea?
  2003-11-18 22:05 Arrays - a good idea? Paul Ganainm <paulsnewsgroups@hotmail.com>
@ 2003-11-18 23:49 ` Yasir Malik <ymalik@cs.stevens-tech.edu>
  0 siblings, 0 replies; 4+ messages in thread

From: Yasir Malik @ 2003-11-18 23:49 UTC (permalink / raw)
  To: Paul Ganainm <paulsnewsgroups@hotmail.com>; +Cc: pgsql-sql

Hello,
I don't think there's any reason you should use arrays.  You can do
everything using tables, and it probably would be easier to use tables
instead.  Extracting information from arrays is also more
difficult if you're using something like JDBC or the connectivity
available in PHP.  I don't know the criteria of when arrays are necessary,
but I cannot think of an example where arrays are absolutely necessary
Regards,
Yasir

On Tue, 18 Nov 2003, Paul Ganainm wrote:

> Date: Tue, 18 Nov 2003 22:05:00 -0000
> From: Paul Ganainm <paulsnewsgroups@hotmail.com>
> To: pgsql-sql@postgresql.org
> Subject: [SQL] Arrays - a good idea?
>
>
>
> Hi all,
>
>
> Even though PostgreSQL supports arrays, is it a good idea to use them? I
> mean, they
>
> a) don't conform to the relational model
>
> and
>
> b) are not transportable
>
>
> so if one is designing an app, should one use them?
>
> When should they not/never be used? What are the criteria for justifying
> their use?
>
>
> Paul...
>
>
> --
>
> plinehan__AT__yahoo__DOT__com
>
> C++ Builder 5 SP1, Interbase 6.0.1.6 IBX 5.04 W2K Pro
>
> Please do not top-post.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
>



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Arrays - a good idea?
@ 2003-11-18 23:51 Yasir Malik <ymalik@heineken.cs.stevens-tech.edu>
  2003-11-19 08:19 ` Re: Arrays - a good idea? Achilleus Mantzios <achill@matrix.gatewaynet.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Yasir Malik @ 2003-11-18 23:51 UTC (permalink / raw)
  To: pgsql-sql

Hello,
I don't think there's any reason you should use arrays.  You can do
everything using tables, and it probably would be easier to use tables
instead.  Extracting information from arrays is also more
difficult if you're using something like JDBC or the connectivity
available in PHP.  I don't know the criteria of when arrays are necessary,
but I cannot think of an example where arrays are absolutely necessary
Regards,
Yasir

On Tue, 18 Nov 2003, Paul Ganainm wrote:

> Date: Tue, 18 Nov 2003 22:05:00 -0000
> From: Paul Ganainm <paulsnewsgroups@hotmail.com>
> To: pgsql-sql@postgresql.org
> Subject: [SQL] Arrays - a good idea?
>
>
>
> Hi all,
>
>
> Even though PostgreSQL supports arrays, is it a good idea to use them? I
> mean, they
>
> a) don't conform to the relational model
>
> and
>
> b) are not transportable
>
>
> so if one is designing an app, should one use them?
>
> When should they not/never be used? What are the criteria for justifying
> their use?
>
>
> Paul...
>
>
> --
>
> plinehan__AT__yahoo__DOT__com
>
> C++ Builder 5 SP1, Interbase 6.0.1.6 IBX 5.04 W2K Pro
>
> Please do not top-post.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
>



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Arrays - a good idea?
  2003-11-18 23:51 Re: Arrays - a good idea? Yasir Malik <ymalik@heineken.cs.stevens-tech.edu>
@ 2003-11-19 08:19 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Achilleus Mantzios @ 2003-11-19 08:19 UTC (permalink / raw)
  To: Yasir Malik <ymalik@heineken.cs.stevens-tech.edu>; +Cc: pgsql-sql

O kyrios Yasir Malik egrapse stis Nov 18, 2003 :

> Hello,
> I don't think there's any reason you should use arrays.  You can do
> everything using tables, and it probably would be easier to use tables
> instead.  Extracting information from arrays is also more
> difficult if you're using something like JDBC or the connectivity
> available in PHP.  I don't know the criteria of when arrays are necessary,
> but I cannot think of an example where arrays are absolutely necessary
> Regards,
> Yasir

PgSQL herself uses arrays in some occasions:

pg_class.relacl and
pg_constraint.conkey, pg_constraint.confkey are such cases.

I think arrays *should* be used when the array fits the model.
For instrance if we want to provide Tree hierarchy capability in a table
one way is to do it with the genealogical approache where
the parents of a node are represented as an array of ids.
(This plus the intarray package makes the performance great).

Also if we want to store polynomial furmulae, we can do that
by storing the coefficients in an float array.
We then can write a C function that calculates the value
of this polyonym given the formula (the array) and X.

In these situations we could use the relational model
but the performance would be prohibiting.

On the other hand, ofcourse, when the size of the child
'relation' is not bounded, we should use the pure relational approach.

As a conclusion, use arrays when

- The size is bounded (Not necessarilly limited)
- The array fits in the model (Intuitively)
- Performance is an issue

In other words:
- Dont be afraid of arrays
- Dont overdo it with arrays!

P.S.

PgSQL jdbc driver does a good job in reading arrays.
Unfortunately when storing arrays, the String must be programmatically
formatted.

> 
> On Tue, 18 Nov 2003, Paul Ganainm wrote:
> 
> > Date: Tue, 18 Nov 2003 22:05:00 -0000
> > From: Paul Ganainm <paulsnewsgroups@hotmail.com>
> > To: pgsql-sql@postgresql.org
> > Subject: [SQL] Arrays - a good idea?
> >
> >
> >
> > Hi all,
> >
> >
> > Even though PostgreSQL supports arrays, is it a good idea to use them? I
> > mean, they
> >
> > a) don't conform to the relational model
> >
> > and
> >
> > b) are not transportable
> >
> >
> > so if one is designing an app, should one use them?
> >
> > When should they not/never be used? What are the criteria for justifying
> > their use?
> >
> >
> > Paul...
> >
> >
> > --
> >
> > plinehan__AT__yahoo__DOT__com
> >
> > C++ Builder 5 SP1, Interbase 6.0.1.6 IBX 5.04 W2K Pro
> >
> > Please do not top-post.
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 3: if posting/reading through Usenet, please send an appropriate
> >       subscribe-nomail command to majordomo@postgresql.org so that your
> >       message can get through to the mailing list cleanly
> >
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
> 

-- 
-Achilleus




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2003-11-19 08:19 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-11-18 22:05 Arrays - a good idea? Paul Ganainm <paulsnewsgroups@hotmail.com>
2003-11-18 23:49 ` Yasir Malik <ymalik@cs.stevens-tech.edu>
2003-11-18 23:51 Re: Arrays - a good idea? Yasir Malik <ymalik@heineken.cs.stevens-tech.edu>
2003-11-19 08:19 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox