I'm currently working to move some plaintext data in Postgres to an encrypted format. I'm using Go and most cryptographic functions intake and output byte arrays. I also need to support key rotation and will generally by using the byte format to pack additional data at the front of values for metadata.
The columns are currently TEXT in Postgres 12.
Would there be any advantage to storing the output directly as BYTEA (in a new column) or would base64 encoding the values and storing them back into the same column provide better performance (faster reads/writes).
Both approaches would require an equal amount of refactoring to support other SELECT statements in the code.
BYTEAcolumn to be more performant.