You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by rakshita04 <ra...@siemens.com> on 2020/05/27 08:49:37 UTC

Are stored in apache ignite cache in random order

Hi Team,

If we use composite key as key to store data in apache ignite cache as
<key,value> pair.
Is the data stored in exact same sequence as we write it in? or its stored
in some random order(may be on the basis of hash value of the key)?
When we are trying to fetch the whole data stored in cache it is returning
us the data in random order and not in the sequence which we used to write
the data(we are using composite key which is combination of multiple
columns)
if you can please explain how data is stored in cache, we would be able to
understand the behavior.

regards,
Rakshita



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Are stored in apache ignite cache in random order

Posted by Gaurav Bajaj <ga...@gmail.com>.
Hello,

Ignite can be thought as any other db where sequence of write doesn't
guarantee sequence of read. In case of querying data via sql, you can make
sure data is returned in sequence by using order by query of particular
column.

In Ignite cache, data is stored across partition and which record is stored
on which partition depends on somekind of hash of the key.

Best Regards,
Gaurav


On Wed, May 27, 2020, 2:19 PM rakshita04 <ra...@siemens.com>
wrote:

> Hi Team,
>
> If we use composite key as key to store data in apache ignite cache as
> <key,value> pair.
> Is the data stored in exact same sequence as we write it in? or its stored
> in some random order(may be on the basis of hash value of the key)?
> When we are trying to fetch the whole data stored in cache it is returning
> us the data in random order and not in the sequence which we used to write
> the data(we are using composite key which is combination of multiple
> columns)
> if you can please explain how data is stored in cache, we would be able to
> understand the behavior.
>
> regards,
> Rakshita
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: Are stored in apache ignite cache in random order

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

Yes, the order of data is undefined. You can use SQL's ORDER BY clause to
define it. I guess that's the only option for now.

You can also iterate over keys (if you know them) in determined order. For
example, if your key is a date, it would be trivial to iterate on it
sequentially.

Regards,
-- 
Ilya Kasnacheev


ср, 27 мая 2020 г. в 11:49, rakshita04 <ra...@siemens.com>:

> Hi Team,
>
> If we use composite key as key to store data in apache ignite cache as
> <key,value> pair.
> Is the data stored in exact same sequence as we write it in? or its stored
> in some random order(may be on the basis of hash value of the key)?
> When we are trying to fetch the whole data stored in cache it is returning
> us the data in random order and not in the sequence which we used to write
> the data(we are using composite key which is combination of multiple
> columns)
> if you can please explain how data is stored in cache, we would be able to
> understand the behavior.
>
> regards,
> Rakshita
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>