You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Dmitry Lazurkin <di...@gmail.com> on 2020/06/03 10:14:17 UTC
How to define compound index with some field and _key
Hello,
I try to define compound index with some field and _key:
create index idx_desc on mytable (somecolumn asc, _key desc);
create index idx_asc on mytable (somecolumn asc, _key asc);
Error: Column doesn't exist: _KEY (state=42000,code=3008)
Is this bug? Because I see _key column in sqlline by using !primarykeys.
I know that I can add new field to value object which contains _key
value. But this is duplication of _key. Is that the only way for achieve
what I would like?
Thank you.
Re: How to define compound index with some field and _key
Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!
Yes, QueryEntity allows you to specify key fields / key field name. Then
you can create index over these fields.
Regards,
--
Ilya Kasnacheev
ср, 3 июн. 2020 г. в 18:08, dilaz03 <di...@gmail.com>:
> Hi, Ilya.
>
> Thank you for reply. My table is defined by QueryEntity and doesn't have
> any
> explicit primary keys. So alias '_key' points to cache key. I can define
> some field with value from cache key, but it's duplication. May be I don't
> know something about cache keys. Can I define cache key from BinaryObject
> field?
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>
Re: How to define compound index with some field and _key
Posted by dilaz03 <di...@gmail.com>.
Hi, Ilya.
Thank you for reply. My table is defined by QueryEntity and doesn't have any
explicit primary keys. So alias '_key' points to cache key. I can define
some field with value from cache key, but it's duplication. May be I don't
know something about cache keys. Can I define cache key from BinaryObject
field?
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: How to define compound index with some field and _key
Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!
How is your table defined? _key is just an implicit alias for all of your
primary key columns. So you should be listing those.
Regards,
--
Ilya Kasnacheev
ср, 3 июн. 2020 г. в 13:14, Dmitry Lazurkin <di...@gmail.com>:
> Hello,
>
> I try to define compound index with some field and _key:
> create index idx_desc on mytable (somecolumn asc, _key desc);
> create index idx_asc on mytable (somecolumn asc, _key asc);
>
> Error: Column doesn't exist: _KEY (state=42000,code=3008)
>
> Is this bug? Because I see _key column in sqlline by using !primarykeys.
>
> I know that I can add new field to value object which contains _key
> value. But this is duplication of _key. Is that the only way for achieve
> what I would like?
>
> Thank you.
>
>