You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Serega Sheypak <se...@gmail.com> on 2015/07/13 11:52:10 UTC

Secondary index for narrow tables. Use it or just do "double insert"

Hi, I have an immutable table with 4 columns:

id1, id2, meta_id1, meta_id2.
Primary key is id1, I select all fields from table "row" by id1. So it's
the fastest way to get data.
Second access path is to select by id2.

I have serious mixed workload. What is better:
1. use secondary index for id2
2. just insert two rows:
id1, id2, meta_id1, meta_id2
id2, id1, meta_id1, meta_id2
and avoid using secondary index.

P.S.
Tried to read PPT notes. What is index for immutable table? It's second
"invisible" table which points id2 as key to id1 (in my case) updated by
coprocessor?

Re: Secondary index for narrow tables. Use it or just do "double insert"

Posted by Yuhao Bi <by...@gmail.com>.
Hi,

I would like to suggest you to use the phoenix secondary index.
It is because,
1.You can choose global index or local index(gain a better performance).
2.Just create index on id2 and query with indexHint can save your disk
space.

And yes secondary index is done by coprocessor.
Am I right?

2015-07-13 17:52 GMT+08:00 Serega Sheypak <se...@gmail.com>:

> Hi, I have an immutable table with 4 columns:
>
> id1, id2, meta_id1, meta_id2.
> Primary key is id1, I select all fields from table "row" by id1. So it's
> the fastest way to get data.
> Second access path is to select by id2.
>
> I have serious mixed workload. What is better:
> 1. use secondary index for id2
> 2. just insert two rows:
> id1, id2, meta_id1, meta_id2
> id2, id1, meta_id1, meta_id2
> and avoid using secondary index.
>
> P.S.
> Tried to read PPT notes. What is index for immutable table? It's second
> "invisible" table which points id2 as key to id1 (in my case) updated by
> coprocessor?
>