5

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... :)

1
  • 3
    Why not take a look at the source code? Or, possibly, you could ask this on a postgresql list as well. Commented Nov 9, 2012 at 16:48

1 Answer 1

7

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.

1
  • 2
    Good to have PostgreSQL expertise from specialists with a source code level understanding of RDBMS on DBA.SE, right? :) Commented Nov 10, 2012 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.