2 edited tags
| link
source | link

Is 'internallength' always useful in custom type definition in Postgres?

In our database we use a custom type to store 3D locations:

CREATE TYPE float3d AS (
  x real,
  y real,
  z real);

In many examples I see INTERNALLENGTH used as a parameter with the definition of custom types. Also, the documentation tells me that "[t]he default assumption is that it is variable-length", if this parameter is omitted. Is this also true for types like the one above where the size can be calculated (3*4 bytes + 4byte padding)? So should I add 16 as internal length to the definition?

Also, are there other parameters that could improve the performance of handling many (~10,000,000) entries using this type?