Hi Afshin, I appreciate the answer, but I already took that into account in my first message, > I tried to include col1 in the index, and it works, but I expect to have many columns, and the overhead is unaffordable. and I also would want to know if this limitation is by design or if it is a bug
Thanks, Jacobo Coll 2015-12-15 15:03 GMT+00:00 Afshin Moazami <[email protected]>: > Hi Nacho, > > One solution is to include the columns that you like to query over, in > your index creation query. > This works for me: > > 0: jdbc:phoenix:localhost> create local index idx2 on test_table (col2) > include (col1); > 2 rows affected (0.642 seconds) > 0: jdbc:phoenix:localhost> explain select * from test_table where col2 = > 'v1-2' and col1 = 'v1-1'; > +------------------------------------------+ > | PLAN | > +------------------------------------------+ > | CLIENT 1-CHUNK PARALLEL 1-WAY RANGE SCAN OVER _LOCAL_IDX_TEST_TABLE > [-32767,'v1-2'] | > | SERVER FILTER BY "COL1" = 'v1-1' | > +------------------------------------------+ > > > > I hope it helps. > > Best, > Afshin > > On Dec 15, 2015, at 8:48 AM, Jacobo Coll <[email protected]> wrote: > > create table test_table (mykey varchar primary key, col1 varchar, col2 > varchar); > create local index idx2 on test_table (col2); > upsert into test_table (mykey, col1, col2) values('k1', 'v1-1', 'v1-2'); > upsert into test_table (mykey, col1, col2) values('k2', 'v2-1', 'v2-2'); > > >
