Search code examples
postgresqlamazon-aurora

Can I configure Aurora DB max identifier length? How?


I have column names that are very long, regardless of the reason for this, I need to store very large names for columns (At least 128), and very large rows overall because of this

mysql has a strong limit of 64 for columns and 65,535 for rows

postgresql has a "configurable" limit of 63 for columns and couldn't find one for rows

My question is this: AWS Aurora offers both DBs, I've been researching and couldn't find whether this limit is configurable in their postgresql product, is it? How can I change this configuration?


Solution

  • The default maximum length for all PostgreSQL identifiers (not just columns names) is 63 bytes (not characters). This can be changed, like the manual informs where you linked:

    can be increased by recompiling PostgreSQL

    Or in more detail here:

    The system uses no more than NAMEDATALEN-1 bytes of an identifier; longer names can be written in commands, but they will be truncated. By default, NAMEDATALEN is 64 so the maximum identifier length is 63 bytes. If this limit is problematic, it can be raised by changing the NAMEDATALEN constant in src/include/pg_config_manual.h.

    Related:

    So while regular PostgreSQL can be adjusted by editing the source and compiling, this is obviously not an option for a hosted service like Amazon Aurora Postgres. So, no, you cannot change this limit.

    There is no maximum length for the sum of all column names of a table in Postgres. There is a maximum number of columns though. 1600 or less, depending on data types. Details: