A secondary index will only be maintained if you go through Phoenix APIs when you update your data table. Create a table over your HBase table instead of a view and use Phoenix UPSERT and DELETE statements to update your data instead of HBase APIs and your mutable secondary index will be maintained. Thanks, James
On Tuesday, August 12, 2014, Saravanan A <[email protected]> wrote: > Hi, > I created view over existing Hbase table and created index on > columns...(at this point my table has 5 records)..Later i added 5 more > records to hbase table and i can able to see 10 record in Phoenix > View...but when i checked Index it has only 1st 5 records...remaining 5 > records are not getting updated...So index over the view will > not automatically update the index??? or we need to re-create the index...?? > > *Step 1:* jdbc:phoenix:zk1.alp.com> select * from "tab2"; > > +------------+------------+------------+------------+------------+------------+--+ > | RowKey | t2_col5 | t2_col3 | t2_col1 | t2_col2 | > t2_col6 | | > > +------------+------------+------------+------------+------------+------------+--+ > | a | 22 | 11 | 1 | 6 | 27 > | | > | b | 23 | 12 | 2 | 7 | 28 > | | > | c | 24 | 13 | 3 | 8 | 29 > | | > | d | 25 | 14 | 4 | 9 | 30 > | | > | e | 26 | 15 | 5 | 10 | vv > | | > > +------------+------------+------------+------------+------------+------------+ > > > *Step 2:* > create index "tab2_t2_col2" on "tab2" ("t2_col2"); > 5 rows affected (1.48 seconds) > > select * from "tab2_t2_col2" > +-------------+------------+ > | cf2:t2_col2 | :RowKey | > +-------------+------------+ > | 27 | a | > | 28 | b | > | 29 | c | > | 30 | d | > | vv | e | > +-------------+------------+ > > *Step 3:* Added 5 more record to hbase table > > select * from "tab2"; > > +------------+------------+------------+------------+------------+------------+--+ > | RowKey | t2_col5 | t2_col3 | t2_col1 | t2_col2 | > t2_col6 | | > > +------------+------------+------------+------------+------------+------------+--+ > | a | 22 | 11 | 1 | 6 | 27 > | | > | b | 23 | 12 | 2 | 7 | 28 > | | > | c | 24 | 13 | 3 | 8 | 29 > | | > | d | 25 | 14 | 4 | 9 | 30 > | | > | e | 26 | 15 | 5 | 10 | vv > | | > | lkiouy | lbftcv | lnmbvf | llkjhj | liuyb | lbcfrtg > | | > | mjhui | mjyfc | mvdrt | mbvty | mufcgb | mvcdr > | | > | njuhy | nloids | ncsrfb | nhtdcb | nvdtbn | noadv > | | > | opiygb | obgvv | ougfvc | oufvcb | onhjvty | ofccv > | | > | pnbgfuh | pdfgvew | pdsvbf | padscv | padfqv | fadfdsv > | | > > +------------+------------+------------+------------+------------+------------+--+ > > *Step 4:* > select * from "tab2_t2_col2"; > +-------------+------------+ > | cf2:t2_col2 | :RowKey | > +-------------+------------+ > | 27 | a | > | 28 | b | > | 29 | c | > | 30 | d | > | vv | e | > +-------------+------------+ > > at step 4 i expected to see 10 record but am only getting 5 record.. > > My Phoenix version 3.0 and Hbase version-- 0.94.15. > > Regards, > Saravanan.A >
