Of course they are stored in the same order, but using special encoding.
It's explained in PArrayDataType:
/**
* The datatype for PColummns that are Arrays. Any variable length
array would follow the below order. Every element
* would be seperated by a seperator byte '0'. Null elements are
counted and once a first non null element appears we
* write the count of the nulls prefixed with a seperator byte.
Trailing nulls are not taken into account. The last non
* null element is followed by two seperator bytes. For eg a, b, null,
null, c, null -> 65 0 66 0 0 2 67 0 0 0 a null
* null null b c null d -> 65 0 0 3 66 0 67 0 0 1 68 0 0 0. The reason
we use this serialization format is to allow the
* byte array of arrays of the same type to be directly comparable
against each other. This prevents a costly
* deserialization on compare and allows an array column to be used as
the last column in a primary key constraint.
*/
On Thu, Apr 13, 2017 at 8:19 AM, Cheyenne Forbes <
cheyenne.osanu.for...@gmail.com> wrote:
> I was wonder if the arrays are stored in the order I add them or they are
> sorted otherwise (maybe for performance reasons)
>