get array data with range

From: "Johny Jugianto" <johny(dot)q(at)rocketmail(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: get array data with range
Date: 2002-01-29 11:02:34
Message-ID: 005501c1a8b4$7486b750$050000c0@pinguin
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message CoL 2002-01-29 15:23:07 Re: get array data with range
Previous Message Dedov Anton 2002-01-29 03:45:02 Again about foreign keys and inheritance