Thread: Question about Array data type in PostgreSQL and their link with hash table concept
Question about Array data type in PostgreSQL and their link with hash table concept
From
Dariyoosh Dariyoosh
Date:
Hi,
I would like to ask a question about Array type. My question is somewhat a comparison betweenhttp://www.postgresql.org/docs/9.3/interactive/arrays.html
Tip: Arrays are not sets; searching for specific array elements can be a sign of database misdesign.
Consider using a separate table with a row for each item that would be an array element.
This will be easier to search, and is likely to scale better for a large number of elements.
association between key & values? where the integer indexes stand in reality for keys?
Thanks in advance,
Re: Question about Array data type in PostgreSQL and their link with hash table concept
From
Luca Vernini
Date:
2014-05-27 14:39 GMT+02:00 Dariyoosh Dariyoosh <d.sunforums@gmail.com>: > Are arrays in PostgreSQL like associative arrays in Oracle PL/SQL hash > tables?, that is an > association between key & values? where the integer indexes stand in reality > for keys? No, arrays in PostgreSQL are just arrays. You can consider the position like a special case of key.. but it is not, because it is just a position and cannot be set. For key value you can consider hstore: http://www.postgresql.org/docs/9.3/static/hstore.html Or build your own multi dimension array. > Thanks in advance, Regards, Lucazeo.
Re: Question about Array data type in PostgreSQL and their link with hash table concept
From
Dariyoosh Dariyoosh
Date:
Hi,
Thanks a lot for your clarification and the link about hstoreOn Tue, May 27, 2014 at 2:44 PM, Luca Vernini <lucazeo@gmail.com> wrote:
2014-05-27 14:39 GMT+02:00 Dariyoosh Dariyoosh <d.sunforums@gmail.com>:No, arrays in PostgreSQL are just arrays.
> Are arrays in PostgreSQL like associative arrays in Oracle PL/SQL hash
> tables?, that is an
> association between key & values? where the integer indexes stand in reality
> for keys?
You can consider the position like a special case of key.. but it is
not, because it is just a position and cannot be set.
For key value you can consider hstore:
http://www.postgresql.org/docs/9.3/static/hstore.html
Or build your own multi dimension array.
> Thanks in advance,
Regards,
Lucazeo.