get array data with range
| От | Johny Jugianto | 
|---|---|
| Тема | get array data with range | 
| Дата | |
| Msg-id | 005501c1a8b4$7486b750$050000c0@pinguin обсуждение исходный текст | 
| Ответ на | SELECT * FROM xy WHERE name LIKE '%german special char' ("Albrecht Berger" <berger1517@gmx.ch>) | 
| Список | 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 по дате отправления: