Curious about size of Binary containing a datatable with string with large max length

I just noticed that the Binary object generated by serializing a DataTable in .NET using the RemObjects datastreamer creates large objects (based on maximum field sizes?)

I serialized 142155 records of a table which resulted in a binary of ~31MB.

So each record uses ~221 bytes.

This is a big number for my table. The datatable contains 19 integer,money or datetime fields and one varchar field of max size 120. average length of the content of the varchar field is ~20.

Does the MaxLength of a field impact the Binary size?

If the DB varchar MaxLength is way too large does this impact memory consumption?

I use compression so I assume the internet network bandwidth usage will not be impacted a lot but it seems imperative that compression is enabled for internet communication.

This is just an informative question, I have no software issue but I am interested out of performance considerations.

If there are best practices regarding the topic please let me know.

Below some details:

No, MaxLength affects neither the binary size nor memory: strings are stored with their actual length.

The row size comes from the data types. Most likely your schema is derived from the DataTable, so money is written as Decimal (16 bytes) and strings as UTF-16:

11 int * 4 + 3 datetime * 8 + 5 money * 16 + varchar (4 + 2 per char) + 3 (null mask) = 195 bytes with 20 chars.

Your 221 bytes match strings of about 33 chars on average.

This is normal. Keep compression on (default in BinMessage), it reduces this data a lot.