Subject Re: [firebird-support] Re: Primary Key of character a problem?
Author Ann Harrison
Raymond,

sorry to take so long in answering - got tied up in a different problem.

>I was thinking (and that is a frightening thing<grin>) that the internal binary trees would be the most efficient if I had a nice even distribution over the values... so in this thinking, I created the PK like this: (remember my PK is a string)PK:=LocalCount+MachineID+MfgID+PlanetID+SolarSysID+GalaxyID
>
>
That's backward from the point of view of prefix compression.

>If Galaxy, SolarSys, and Planet were first, well I would have to look at all the letters and all would be the same up until I finally arrived at the 7th character and then I would finally be able to start to narrow down the search...
>
Ah, but prefix compression turns those seven characters into a single
binary 7. If more leading characters duplicate the previous index
entry, then they'll be compressed too. Generally, your key will consist
of a binary 19 and the last byte of the LocalCount, or 19 and the last
two bytes of LocalCount.

Regards,


Ann

Regards,