I have some byte data(millions of rows), and currently, I am converting to base64 first, and storing it as TEXT. The data is indexed on a row that contains base64 data. I assume Postgres does the conversion to base64 itself.
Will it be faster if I store using BYTEA data type instead?
How will the indexed queries be affected on two data types?
Converting bytes to text using Base64 will consume 33% more space than bytes. Even this would be faster, you will use quite more space on disk. Loading and storing data should be slower as well. I see no advantage in doing that.
Postgres supports indices on BYTEA
columns. Since the bytes are shorter than the text, byte columns with indexes should be faster than text columns with indices as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With