Subject Re: [firebird-support] New record size of 107496 bytes is too long.
Author Helen Borrie
At 18:30 23/08/2008, you wrote:
>Hello
>
>I get this message from embedded Firebird 2.1.1 when creating one of my
>tables.
>Can I do something about it ? Can I enlarge this limit ?

No. The limit is 64 KB.

>It is so ugly !
>
>Why does Firebird have this restriction ?

Because even a record size of 64 KB is on the outer limits of reasonableness for a relational database.

>Besides, I use VARCHAR in my field
>definitions so an actual record only rarely will reach the maximum length,
>if at all.

So make varchars of the appropriate size. Actually a 32 KB varchar isn't reasonable either. A design rule of thumb would be to limit the size of varchars to 2 bytes less than the maximum width allowed for indexing your column.

>If I declare a VARCHAR column as BLOB CHARACTER SET UNICODE_FSS, can I insert a string in it just as if the column was VARCHAR with INSERT INTO Table

If you declare it as a BLOB it's not a varchar. ;-) Declare the BLOB as SUB_TYPE 1 (or SUB_TYPE TEXT, if you prefer) and you can operate on the data in many of the same ways you do with varchars.

With a text BLOB you can pass a string as input to a BLOB column in insert and update statements. A string cannot be passed as the argument for a stored procedure input parameter that is declared as a BLOB, text or not.

With regard to UNICODE_FSS varchars, keep in mind that the maximum length of varchar is 32765 bytes, not characters. UNICODE_FSS uses 3 bytes per character so your maximum varchar length is 10,921 bytes. I mentioned that since it reduces the maximum size of a substring from your BLOB. UNICODE_FSS is effectively deprecated in Fb 2.1, actually.

>... ? What are the differences between working with BLOB and VARCHAR columns
>?

The main difference is that you can't index a BLOB column; and BLOBs don't occupy space in the main record, other than a 4-byte BLOB_ID. BLOBS don't have a size limit, either.

./heLen