Which way is the most efficient way to save sql data compare base-64 or binary? I am using a SQL Server database.
I believe with binary we have to store it as binary or text data but with base-64 we can store it as text.
I think binary is base on 8 bits/1 byte and base 64 is what I don’t know
The example of the text HELLO WORLD. TODAY IS MONDAY.
[Base 64 result][2]:SEVMTE8gV09STEQuIFRPREFZIElTIE1PTkRBWS4=
[Binary Result][3]:01001000 01000101 01001100 01001100 01001111 00100000 01010111 01001111 01010010 01001100 01000100 00101110 00100000 01010100 01001111 01000100 01000001 01011001 00100000 01001001 01010011 00100000 01001101 01001111 01001110 01000100 01000001 01011001 00101110
Base 64 only uses 6 bits per character, the other 2 bits of the byte are wasted, meaning you are 33.3% less efficient than using BLOB storage.
The advantage of Base64 is for when you MUST use a safely transferable text string, and the loss in storage efficiency is acceptable, such as in an XML file.