Subject Re: [firebird-support] AW: Performance comparision for primary keys - int vs. varchar
Author Hannes Streicher
Guten Tag ""Köditz,

on another list if have read the following comment on a similar
question

integers are compared as integers, one operation

strings are compared on a per characters basis

so changing your integer into a length 10 string would mean 10
comparisons instead of one


but i definetly would like to read an answer from someone wo is more
into the depth of firebird internals




>
>

>
>
> Hi,
>
>
>
> I’m using integer IDs for primary keys in my tables. What if I
> would use varchar fields instead? Will I lose performance in that
> case, especially for big tables? Will joins still work as fast as they do for the integer column.
>
>
>
> In my case I have a table TBL_BANK (
>
> BANK_ID int,
>
> BIC varchar(11),
>
> …
>
> )
>
>
>
> So what will happen if I switch the PK to BIC in that case? I would
> change the FKs to BIC too. I don’t know how the index keys are build
> and stored in firebird. So I cannot say this way is faster than the
> other one. But maybe someone else can do.
>
>
>
> Regards
>
> Martin
>
>
>
>


--
Mit freundlichen Grüssen
Hannes Streicher mailto:HStreicher@...