You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my Postgres 9.6+ tables, I want to use an xid as a unique indexed column and also sometimes as primary key or foreign key column too. Is it more performant to store it as a 20 character string or 12 byte binary? I initially thought binary would be more efficient, but this article suggests otherwise.
Does anyone have any experience using a bytea as a primary key? If so, is it more efficient to use the default bytea hex format or the older bytea escape format?
The text was updated successfully, but these errors were encountered:
If so, is it more efficient to use the default bytea hex format or the older bytea escape format?
As far as I know, the escape and hex options only apply to how to represent the bytea value (input/output), it does not concern itself with the on-disk format, so efficiency of storage is a non-issue.
See also: https://www.postgresql.org/docs/current/static/datatype-binary.html
a 20 character string or 12 byte binary
You'll lose 8 bytes storage per row, so for storage efficiency, bytea(12) beats text(20).
In my Postgres 9.6+ tables, I want to use an xid as a unique indexed column and also sometimes as primary key or foreign key column too. Is it more performant to store it as a 20 character string or 12 byte binary? I initially thought binary would be more efficient, but this article suggests otherwise.
Does anyone have any experience using a bytea as a primary key? If so, is it more efficient to use the default
bytea hex
format or the olderbytea escape
format?The text was updated successfully, but these errors were encountered: