Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a question, about the internal handling of array columns in Postgres. Does the engine handle it as a classical array with memory alloc or is it somehow a pointer list.

It would be interesting to know - I have a few questions to answer myself concerning performance... :)

share|improve this question
Why not take a look at the source code? Or, possibly, you could ask this on a postgresql list as well. – dezso Nov 9 '12 at 16:48
up vote 6 down vote accepted

Arrays are defined in src/includes/utils/array.h and src/backend/utils/adt/arrayfuncs.c and the other array* files in src/backend/utils/adt/.

An array is a VARLENA (see src/backend/utils/adt/varlena.c) which is a palloc()'d type, a scoped-storage wrapper around malloc(). Arrays are block-allocated data, not linked lists.

share|improve this answer
Good to have PostgreSQL expertise from specialists with a source code level understanding of RDBMS on DBA.SE, right? :) – dezso Nov 10 '12 at 8:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.