Subject | AW: [firebird-support] binary or string? |
---|---|
Author | Alexander Gräf |
Post date | 2004-12-11T18:49:37Z |
> -----Ursprüngliche Nachricht-----CHAR(16) (16 hexadecimal coded chars) is not for discussion, as it will be *much* slower. Your only available options are INT64 or CHAR(8) BINARY. Anyway, INT64 is faster when comparing, which is needed in table joins.
> Von: Storage Box [mailto:spam@...]
> Gesendet: Samstag, 11. Dezember 2004 19:46
> An: firebird-support@yahoogroups.com
> Betreff: RE: [firebird-support] binary or string?
>
> My main concern is how efficiently they're stored in the DB.
> If joining two 64-bit integers together in a query is faster
> than two char(16) octets, than I'll take your advice. I
> would imagine it would be much faster as numeric comparisons
> are generally faster than character-based comparisons (in
> probably most modern databases).
Simply use INT64, and don't fiddle arround with CHAR. There is simply one big problem with using CHAR (xy) with binary data: Most database administration tools are not aware of the fact that you are misusing string fields for binary data. In my case, I'm not able to write a simple query like this:
SELECT * FROM Table1 WHERE Uuid = '...';
Simply because '...' could contain null-chars and control-chars and other stuff. It is easier to write this:
SELECT * FROM Table1 WHERE Int64PKEY = 26589734353;
In my case CHAR(xy) BINARY was the only option, in your case, you could use both, but you *should* use Int64 data type.
Regards, Alex