Subject Re: [IB-Architect] Working of indices
Author Arno Brinkman
Hi,

> >Has every a collation (in same character-set) it's own index ?
>
> No, or not exactly.... <snip>

Okey, i understand.

But how does the engine know when i do
"... WHERE FirstName = 'a' " that he must convert
(using the collate from FirstName) the value 'a' to the
right representation for index-match ?


> Key creation is one of the more interesting parts of the index
> code. The key that's stored in an index node has been rearranged
> so that the code that walks the index can just compare values
> byte by byte without considering the datatype. All numbers,
> except 8 byte integers are converted to double precision. The
> floating point number is taken apart and reconstructed so it
> compares byte wise. Dates are also stored as double precision
> numbers and manipulated the same way.

Do you understand "TimeStamp, Date and Time" under "Dates" ?
Just want to know for sure that i understand what's done in the engine.

> Trailing zeros and spaces are eliminated. For a compound key,
> each part is expanded to a multiple of 5 bytes, after the zeros
> are eliminated. A segment count is added every fifth byte -
> zero for the first segment, 1 for the second and so on. <snip>

Okey, very clear.

I'll explain it my way to see if i understand it.

All indices (from a specific relation) are put as index-nodes
in an Index Root Page (=IRP further). The index-nodes
inside the IRP contains information such as page-pointer,
unique, descending, primary, foreign, etc...
The page-pointer points to a Index B-Tree node Page
(=IBP further) with Level-1 or Level-0. IBP Level-1
contains the key value (prefix, length and data) and
a pointer to the IBP Level-0 page. Level-0 is lowest
page in the index-tree which contains the key value
(prefix, length and data) and a pointer to the data-record in
a data-page. From an IBP you can walk up and down
in the same Level with the sibling information which
each IBP contains.


Can there be more levels as 0 or 1 ?
So yes, when are higher levels made ?

What information does the data-record pointer contain.
How does the engine know in what data-page/node to look ?


> This probably creates more confusion than it resolves, so please
> ask questions as they occur.

No, not more confusion for me.
This was exactly the information where i'm looking for.

> Regards,
>
> Ann
> www.ibphoenix.com
> We have answers.

Yes you have :-)

Thanks, very very much.

Kindly regards,
Arno Brinkman
ABVisie