<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Phoenix not using local index in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Phoenix-not-using-local-index/m-p/198829#M59544</link>
    <description>&lt;P&gt;Although this was answered earlier over a support ticket, updating the details here for any future visitor.&lt;/P&gt;&lt;P&gt;Phoenix in HDP 2.5 and above includes &lt;A href="https://issues.apache.org/jira/browse/PHOENIX-1734"&gt;PHOENIX-1734&lt;/A&gt; - where the Phoenix local indexes are co-located in the same region where the corresponding data exists, although on a different column family.&lt;/P&gt;&lt;P&gt;In the above explain plan, the output actually tells that the local index is in use:  "RANGE SCAN OVER TEST_TABLE [1,'v1-2']"  --&amp;gt;      Means its a range scan (instead of a full table scan otherwise), on the data table using the local index (type 1 = local index)  and the given value of "v1-2".&lt;/P&gt;</description>
    <pubDate>Tue, 02 May 2017 09:55:48 GMT</pubDate>
    <dc:creator>rmaruthiyodan</dc:creator>
    <dc:date>2017-05-02T09:55:48Z</dc:date>
    <item>
      <title>Phoenix not using local index</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Phoenix-not-using-local-index/m-p/198828#M59543</link>
      <description>&lt;P&gt;I am trying this on HDP 2.5.3:&lt;/P&gt;&lt;PRE&gt;create table if not exists test_table (mykey varchar primary key, col1 varchar, col2
archer);&lt;/PRE&gt;&lt;PRE&gt;
create local index if not exists idx2 on test_table (col2); &lt;/PRE&gt;&lt;PRE&gt;upsert into test_table (mykey, col1, col2) values('k1', 'v1-1', 'v1-2'); &lt;/PRE&gt;&lt;PRE&gt;upsert into test_table (mykey, col1, col2) values('k2', 'v2-1', 'v2-2'); &lt;/PRE&gt;&lt;PRE&gt;upsert into test_table (mykey, col1, col2) values('a2', 'v2-1', 'v3-2');&lt;/PRE&gt;&lt;PRE&gt;
upsert into test_table (mykey, col1, col2) values('bv2', 'v2-1', 'v4-2');&lt;/PRE&gt;&lt;PRE&gt;
upsert into test_table (mykey, col1, col2) values('c2', 'v2-1', 'v5-2');&lt;/PRE&gt;&lt;PRE&gt;
upsert into test_table (mykey, col1, col2) values('x2', 'v2-1', 'v6-2'); &lt;/PRE&gt;&lt;PRE&gt;upsert into test_table (mykey, col1, col2) values('y2', 'v2-1', 'v7-2');&lt;/PRE&gt;&lt;PRE&gt;select using the index
explain select col2 from test_table where col2 = 'v1-2'; &lt;/PRE&gt;&lt;PRE&gt;+----------------------------------------------------------------------------------+
|                                       PLAN                                       |
+----------------------------------------------------------------------------------+ 

| CLIENT 1-CHUNK PARALLEL 1-WAY ROUND ROBIN RANGE SCAN OVER TEST_TABLE [1,'v1-2']  |&lt;/PRE&gt;&lt;P&gt;|     SERVER FILTER BY FIRST KEY ONLY                                              | &lt;/P&gt;&lt;PRE&gt;+----------------------------------------------------------------------------------+ &lt;/PRE&gt;&lt;PRE&gt;2 rows selected (0.008 seconds)&lt;/PRE&gt;&lt;PRE&gt;same thing with a hint
explain select /*+ INDEX(test_table idx2) */  col2 from test_table where col2 = 'v1-2';

&lt;/PRE&gt;&lt;P&gt;Any reason it isn't using the index. We have tried adding over 400 rows with the same results.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2017 21:59:24 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Phoenix-not-using-local-index/m-p/198828#M59543</guid>
      <dc:creator>william_prender</dc:creator>
      <dc:date>2017-04-14T21:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Phoenix not using local index</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Phoenix-not-using-local-index/m-p/198829#M59544</link>
      <description>&lt;P&gt;Although this was answered earlier over a support ticket, updating the details here for any future visitor.&lt;/P&gt;&lt;P&gt;Phoenix in HDP 2.5 and above includes &lt;A href="https://issues.apache.org/jira/browse/PHOENIX-1734"&gt;PHOENIX-1734&lt;/A&gt; - where the Phoenix local indexes are co-located in the same region where the corresponding data exists, although on a different column family.&lt;/P&gt;&lt;P&gt;In the above explain plan, the output actually tells that the local index is in use:  "RANGE SCAN OVER TEST_TABLE [1,'v1-2']"  --&amp;gt;      Means its a range scan (instead of a full table scan otherwise), on the data table using the local index (type 1 = local index)  and the given value of "v1-2".&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2017 09:55:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Phoenix-not-using-local-index/m-p/198829#M59544</guid>
      <dc:creator>rmaruthiyodan</dc:creator>
      <dc:date>2017-05-02T09:55:48Z</dc:date>
    </item>
  </channel>
</rss>

