Subject Re: [firebird-support] What are the trade-offs of CHAR vs. VARCHAR?
Author Richard Damon
On 11/12/19 12:38 PM, cte677@... [firebird-support] wrote:
>  
>
> What are the trade-offs of CHAR vs. VARCHAR?  I know that VARCHAR
> consumes less space.  Anything thing else (are VARCHAR searches slower)?
>
In some implementations of SQL (I don't know if firebird is one of
them), a row without any variable length items (like VARCHAR) and thus
of fixed length could be stored in a somewhat optimized way making its
access somewhat faster because all the records were the same size.

VARCHAR also doesn't always take less space, as very short CHAR fields
can be smaller than the overhead of a VARCHAR, and if the CHAR field is
storing a value that is always the same length (like maybe a hash code)
the overhead of VARCHAR is just wasted.

--
Richard Damon