GDA: string lengths (was Re: GDA save missing records)

Keith Bellairs keith at bellairs.org
Mon Feb 18 16:54:24 EST 2008


I think that depends on the DB. Using VARCHAR at least gives the engine a
chance to optimize storage. CHAR is good for truly fixed length strings.

On Feb 18, 2008 3:56 PM, Graham Leggett <minfrin at sharp.fm> wrote:

> Phil Longstaff wrote:
>
> > Well, as I originally said, I can use a TEXT type which allows up to 64K
> > byte strings.  Although not unlimited, I assume this is long enough for
> > everyone's purposes.  MySQL stores them as 2byte length + chars.  I will
> > need to check that that libgda has some good method of creating them.
> > Of course, I could also just try varchar(2048) instead of varchar(50),
> > which should also be sufficient.  I assume that the db tries to optimize
> > space so that storing a 1000 char string and storing a 1 char string in
> > a varchar(2048) don't use the same amount of space.
>
> Generally, the database doesn't do this - it will allocate 2048 chars,
> whether you use 1 char or 1000. The upside of this is that it is very
> quick, the downside is that it wastes a lot of space.
>
> Unlimited or "large" text strings are optimised, only because they have
> to be to be stored practically.
>
> Regards,
> Graham
> --
>
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>
>


More information about the gnucash-devel mailing list