Board index » delphi » Interbase VARCHAR datatype

Interbase VARCHAR datatype

What's the overhead of VARCHAR datatypes? If I define a field as
VARCHAR(10000) and store a one-character string in it, how much space
(approximately) is taken up? I'm trying to decide whether to use a BLOB
field or a large VARCHAR field for my application.

Is this the best place for Interbase questions/discussion? I couldn't see a
news group for Interbase.

Thanks.
-------------
Keith Edmunds
Reading,   UK
-------------

 

Re:Interbase VARCHAR datatype


Quote
Keith Edmunds wrote:

> What's the overhead of VARCHAR datatypes? If I define a field as
> VARCHAR(10000) and store a one-character string in it, how much space
> (approximately) is taken up? I'm trying to decide whether to use a BLOB
> field or a large VARCHAR field for my application.

> Is this the best place for Interbase questions/discussion? I couldn't see a
> news group for Interbase.

> Thanks.
> -------------
> Keith Edmunds
> Reading,   UK
> -------------

Keith:

InterBase does post field compression so 1 character in a 1000 byte
varchar field will take about 20 bytes. 2 characters would take about 21
and 3 about 22.

hope this helps

--

Robert Schieck
-----------------------------------------------------------------------
MER Systems Inc.

Client/Server Development and Training using Delphi,  InterBase and
Oracle

InterBase page  http://www.mers.com/interbase.html
udflib page     http://www.mers.com/product.html
TDUG page       http://www.mers.com/tdug.html      -Toronto Delphi Users
Group

Re:Interbase VARCHAR datatype


Quote
Keith Edmunds (k...@itworks.demon.co.uk) wrote:

: What's the overhead of VARCHAR datatypes? If I define a field as
: VARCHAR(10000) and store a one-character string in it, how much space
: (approximately) is taken up? I'm trying to decide whether to use a BLOB
: field or a large VARCHAR field for my application.

: Is this the best place for Interbase questions/discussion? I couldn't see a
: news group for Interbase.

A varchar only occupies the required amount of space to hold the column
in the row. IB actually performs run length encoding of a row anyway thus
you typically find that there is less of a footprint for your data as a
whole than you'd presume assuming lots of repetitous bytes in the rows.

A Blob is held in separate page space to the row (row contains a quad-word
pointer to where the blob data is held). Unlike regular types, InterBase
does not compress or perform machine translations (such as from VAX to
HPUX). You could of course roll your own filters which is more effort.

--
Nigel Campbell            Voice: (613) 738-1338 ext 3016   P.O. Box 9707,Stn.T
Business Intelligence       FAX: (613) 738-0002            3755 Riverside Dr.
Cognos Incorporated       Email: nig...@cognos.com         Ottawa ON K1G 4K9
http://www.cognos.com                                      CANADA

My comments are my personal opinion and are not the opinion of my employer or
anyone else.  I claim copyright in all my statements and give no one the right
to copy them (even if they are quoted elsewhere) in any medium except on
netnews or email. In particular, no one can reproduce or reprint my comments
in print or any visual medium without getting my explicit permission.

Other Threads