ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vladimir Ozerov <voze...@gridgain.com>
Subject Re: Sorted index includes the cache key and the affinity key columns. Why?
Date Fri, 27 Oct 2017 15:01:31 GMT
Andrey,

In general case we do not store any values in the index. Essentially index
is a sequence of so-called "links" (i.e. pointers) to real data rows,
sorted in accordance with indexed column. When two rows have the same
indexed value, we need to sort them somehow still. This is where key and
possibly affinity key are used for additional comparisons. This is typical
index implementation for many databases.

Sometimes we store ("inline") real values in the index for performance
reasons as it may dramatically speedup index search at the cost of
additional memory/disk space. In this case it is possible that some part of
key/affinity key is inlined as well.

On Thu, Oct 26, 2017 at 4:39 AM, Andrey Kornev <andrewkornev@hotmail.com>
wrote:

> Hello,
>
> Ignite adds the cache key and optionally the affinity key (if defined) as
> two last columns of all user-defined indexes (line 301 in
> H2TableDescriptor). For example, given a user index salary_idx including a
> single field "salary", the actual index is going to look like this:
>
> CREATE INDEX "SALARY_IDX" ON "mycache"."PERSON" ("SALARY" ASC, "_KEY" ASC)
>
> I'm wondering what is the purpose of doing so. Could someone knowledgeable
> (Vladimir O., for example) share their insights?
>
> Thanks
> Andrey
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message