Ordering Table Columns in Postgres

Another post about the ordering of columns in Postgres

For GitLab we require that columns of new tables are ordered to use the least amount of space. An easy way of doing this is to order them based on the type size in descending order with variable sizes (text, varchar, arrays, json, jsonb, and so on) at the end.

Similar to C structures the space of a table is influenced by the order of columns. This is because the size of columns is aligned depending on the type of the following column.