get array data with range - Mailing list pgsql-sql

From Johny Jugianto
Subject get array data with range
Date
Msg-id 005501c1a8b4$7486b750$050000c0@pinguin
Whole thread Raw
In response to SELECT * FROM xy WHERE name LIKE '%german special char'  ("Albrecht Berger" <berger1517@gmx.ch>)
List pgsql-sql
hi, all

1. can i do something this in postgresql
"SELECT array_data[1..20] FROM mytable WHERE condition"
i want to get certain data with range in my array data.
if i fetch all data, it took take a long time (very long time just for fetch
from database).

i'm trying with maximum array size (for me it's very big)
"INSERT INTO mytable(mytable_id, array_data) VALUES(1, '{1,2,3,.......so on
until 1000000}')"
it's fast when insert or update :-), but very slow when fetch/select :-(

is there a trick to do it?

second question.
2. which are better (from speed and size side)?
i make "one" table with array like this
TABLE mytable
mytable_id         |  array_data
-------------------------------------
1                       | {1,2,...,100000}
2                       | {1,2,...,100000}
3                       | {1,2,...,100000}
....

or like this one, many table but no array
TABLE mytable_1
was_array_data
----------------
1
2
...
100000

TABLE mytable_2
was_array_data
----------------
1
2
...
100000

TABLE mytable_3
...


Thanks in advance

Best Regards
Johny Jugianto




pgsql-sql by date:

Previous
From: Allan Engelhardt
Date:
Subject: Re: export/save meta data
Next
From: pocm@rnl.ist.utl.pt (Paulo J. Matos)
Date:
Subject: Date Parse