Bug #34028 save bandwidth on streams (default to base64 instead of hex)
Submitted: 24 Jan 2008 5:25 Modified: 11 Nov 2009 2:38
Reporter: Ralf Hauser Email Updates:
Status: Won't fix Impact on me:
None 
Category:Connector / J Severity:S5 (Performance)
Version: OS:Any
Assigned to: CPU Architecture:Any

[24 Jan 2008 5:25] Ralf Hauser
Description:
hexEscapeBlock() in com.mysql.jdbc.PreparedStatement.streamToBytes() roughly doubles the size of what is put on the wire with the possible side-effects as hopefully soon made transparent in the documentation by Bug #34018

How to repeat:
insert a blob

Suggested fix:
base64 should only add 25% of size instead of ~100% of hex
[24 Jan 2008 13:30] Mark Matthews
Notice that this style of escaping is only used when the character set in use can have embedded "\" in the bytes which represent characters (essentially all multi-byte character sets that aren't UTF-8).

As things stand now, the JDBC driver can't use anything other than hex, as hex is what the parser supports for escaping binary data, and there is no Base64 function in the server that we could use.

If some day the server implements Base64, we could use it. Alternatively, enable server-side prepared statements, they're able to send binary streams as-is without escaping them, as there is a mechanism to do so.