Fork me on GitHub
#sql
<
2017-12-19
>
owen15:12:06

anyone have knowledge storing byte arrays into PSQL? I have a bytea column I'm trying to store a nippy/freeze'd (serialized compressed byte-array) value in. If I (spit "out" (String. (nippy/freeze object))) its 11 bytes, if I INSERT (nippy/freeze object) its around 1200 bytes

owen16:12:23

same results if I create a prepared-statement and call .setBytes on it

owen16:12:07

looks like Im stuck

danielcompton19:12:49

@owen I'm using HugSQL and I just store a byte-array directly to it

owen19:12:32

@danielcompton oh I was able to store it successfully, just confused if the inflation in byte size is preventable

owen19:12:39

or is just PSQL overhead for byte array storage

owen19:12:33

from the PSQL docs: > bytea 1 or 4 bytes plus the actual binary string variable-length binary string

owen19:12:53

I would expect an 11 byte bytea to be a max or 15 bytes

owen19:12:57

but I also stored a 99KB image in a bytea field using the PSQL recommended practices in here: https://jdbc.postgresql.org/documentation/head/binary-data.html#binary-data-example and stilll saw an 11-12KB increase

owen19:12:06

so I'm guessing its just bytea overhead

owen19:12:37

thank you though!

danielcompton20:12:16

How are you measuring the size?