The octet_length function returns the length in bytes size of a bytea field. From the docs: “Number of bytes in binary string”.


SELECT octet_length(the_data_field) FROM table_name;
# byte size

More binary string functions