Subject | Re: What are the trade-offs of CHAR vs. VARCHAR? |
---|---|
Author | |
Post date | 2019-11-13T17:42:16Z |
Here is the link to the definition of CHAR and VARCHAR field definitions from the IB-Experts site...
It defines the storing of CHAR and VARCHAR in the same manner, though the VARCHAR data type is provided the extra two bytes for actual length information.
In neither the CHAR or VARCHAR definitions is it noted that unused space is filled with nulls or blank data as both are stored as variable length fields internally within a table. However, the CHAR data type, as would be expected, can only store as a maximum, the number of characters that its original definition set forth. The VARCHAR field can hold up to over 32,000+ bytes of data.
Thus Firebird, does in fact store VARCHAR data within its tables as all other database engines do, Its only deviation is that the CHAR field definition is made variable, similar to a VARCHAR field but only up to the maximum length initially defined.
So my understanding of how the VARCHAR field works is correct and what I have stated earlier.
Anne Harrison's comments also mirror what this link provides as when either a CHAR or VARCHAR field is placed in memory than the full lengths of each field definition type is provided space for.
The reading suggestions you recommended are what provided the link above to the IB-Experts site...
Steve Naidamast
Sr. Software Engineer