pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
storing large arrays of floats
2+ messages / 2 participants
[nested] [flat]

* storing large arrays of floats
@ 2007-11-02 20:05 Kees Kling <ckling@planet.nl>
  2007-11-02 20:56 ` Re: storing large arrays of floats Heikki Linnakangas <heikki@enterprisedb.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Kees Kling @ 2007-11-02 20:05 UTC (permalink / raw)
  To: pgsql-jdbc

HI

I have to store an array of 50,000 floats in a postgres database. At 
firts I tried to store it as float[], but that take s to much time  for 
jdbc to convert the data  so that it  can be stored in the database. 
Next I tried to store it as byte[] array in a BYTEA column. This worked 
ok, but when I inspect the data at the serverside the datasize increased 
with a factor 1,5 to 2 and I see a lot of escape(\0) characters. What I 
mean to do is storing the bunch of data and retrieving subselections of 
the data with the help of Plperl fucntions. Now I can't restore the data 
at serverside. What is the clue? Do I have to store the data with 
another function as "preparedstatement.setBytes" or must I use another 
columntype.

Thanks
Kees Kling



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

* Re: storing large arrays of floats
  2007-11-02 20:05 storing large arrays of floats Kees Kling <ckling@planet.nl>
@ 2007-11-02 20:56 ` Heikki Linnakangas <heikki@enterprisedb.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Heikki Linnakangas @ 2007-11-02 20:56 UTC (permalink / raw)
  To: Kees Kling <ckling@planet.nl>; +Cc: pgsql-jdbc

Kees Kling wrote:
> I have to store an array of 50,000 floats in a postgres database. At 
> firts I tried to store it as float[], but that take s to much time  for 
> jdbc to convert the data  so that it  can be stored in the database. 
> Next I tried to store it as byte[] array in a BYTEA column. This worked 
> ok, but when I inspect the data at the serverside the datasize increased 
> with a factor 1,5 to 2 and I see a lot of escape(\0) characters. What I 
> mean to do is storing the bunch of data and retrieving subselections of 
> the data with the help of Plperl fucntions. Now I can't restore the data 
> at serverside. What is the clue? Do I have to store the data with 
> another function as "preparedstatement.setBytes" or must I use another 
> columntype.

Sounds like you need to rethink your schema. Instead of using an array, 
consider using a child table.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com



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


end of thread, other threads:[~2007-11-02 20:56 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-11-02 20:05 storing large arrays of floats Kees Kling <ckling@planet.nl>
2007-11-02 20:56 ` Heikki Linnakangas <heikki@enterprisedb.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