You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Pedro Gandola <pe...@gmail.com> on 2016/01/14 17:34:46 UTC

Local Indexes are not used to query views

Hi,

I've noticed that Phoenix (using version 4.4) when querying a view it does
not consider the original table local indexes to optimise the query.

If I explain my query over the original table it's using the local index
properly:

*EXPLAIN SELECT * FROM BIDDING_EVENTS WHERE wTs IS NOT NULL;*
> CLIENT 300-CHUNK PARALLEL 300-WAY RANGE SCAN OVER
> _LOCAL_IDX_BIDDING_EVENTS [-32768]
>      SERVER FILTER BY "WTS" IS NOT NULL


However, If I create a view using the exact same query and explain I get a
full scan.


> *CREATE VIEW WINS_VIEW AS SELECT * FROM BIDDING_EVENTS WHERE wTs IS NOT
> NULL; *

*EXPLAIN SELECT * FROM WINS_VIEW;*
> CLIENT 300-CHUNK PARALLEL 1-WAY FULL SCAN OVER BIDDING_EVENTS
>      SERVER FILTER BY WTS IS NOT NULL


Is this the expected behaviour? Or could this be an issue with 4.4 version?

Thank you
Cheers
Pedro

Re: Local Indexes are not used to query views

Posted by Pedro Gandola <pe...@gmail.com>.
Issue created: https://issues.apache.org/jira/browse/PHOENIX-2597

Cheers
Pedro

On Thu, Jan 14, 2016 at 5:19 PM, Pedro Gandola <pe...@gmail.com>
wrote:

> Hi James,
>
> Sure, I will do it.
>
> Thanks
> Cheers
>
> On Thu, Jan 14, 2016 at 5:01 PM, James Taylor <ja...@apache.org>
> wrote:
>
>> Thanks for reporting this, Pedro. I tried it on 4.7-SNAPSHOT and it works
>> for non local indexes, but not for local indexes. Please file a JIRA.
>>
>>    James
>>
>> On Thu, Jan 14, 2016 at 8:34 AM, Pedro Gandola <pe...@gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> I've noticed that Phoenix (using version 4.4) when querying a view it
>>> does not consider the original table local indexes to optimise the query.
>>>
>>> If I explain my query over the original table it's using the local index
>>> properly:
>>>
>>> *EXPLAIN SELECT * FROM BIDDING_EVENTS WHERE wTs IS NOT NULL;*
>>>> CLIENT 300-CHUNK PARALLEL 300-WAY RANGE SCAN OVER
>>>> _LOCAL_IDX_BIDDING_EVENTS [-32768]
>>>>      SERVER FILTER BY "WTS" IS NOT NULL
>>>
>>>
>>> However, If I create a view using the exact same query and explain I get
>>> a full scan.
>>>
>>>
>>>> *CREATE VIEW WINS_VIEW AS SELECT * FROM BIDDING_EVENTS WHERE wTs IS NOT
>>>> NULL; *
>>>
>>> *EXPLAIN SELECT * FROM WINS_VIEW;*
>>>> CLIENT 300-CHUNK PARALLEL 1-WAY FULL SCAN OVER BIDDING_EVENTS
>>>>      SERVER FILTER BY WTS IS NOT NULL
>>>
>>>
>>> Is this the expected behaviour? Or could this be an issue with 4.4
>>> version?
>>>
>>> Thank you
>>> Cheers
>>> Pedro
>>>
>>
>>
>

Re: Local Indexes are not used to query views

Posted by Pedro Gandola <pe...@gmail.com>.
Hi James,

Sure, I will do it.

Thanks
Cheers

On Thu, Jan 14, 2016 at 5:01 PM, James Taylor <ja...@apache.org>
wrote:

> Thanks for reporting this, Pedro. I tried it on 4.7-SNAPSHOT and it works
> for non local indexes, but not for local indexes. Please file a JIRA.
>
>    James
>
> On Thu, Jan 14, 2016 at 8:34 AM, Pedro Gandola <pe...@gmail.com>
> wrote:
>
>> Hi,
>>
>> I've noticed that Phoenix (using version 4.4) when querying a view it
>> does not consider the original table local indexes to optimise the query.
>>
>> If I explain my query over the original table it's using the local index
>> properly:
>>
>> *EXPLAIN SELECT * FROM BIDDING_EVENTS WHERE wTs IS NOT NULL;*
>>> CLIENT 300-CHUNK PARALLEL 300-WAY RANGE SCAN OVER
>>> _LOCAL_IDX_BIDDING_EVENTS [-32768]
>>>      SERVER FILTER BY "WTS" IS NOT NULL
>>
>>
>> However, If I create a view using the exact same query and explain I get
>> a full scan.
>>
>>
>>> *CREATE VIEW WINS_VIEW AS SELECT * FROM BIDDING_EVENTS WHERE wTs IS NOT
>>> NULL; *
>>
>> *EXPLAIN SELECT * FROM WINS_VIEW;*
>>> CLIENT 300-CHUNK PARALLEL 1-WAY FULL SCAN OVER BIDDING_EVENTS
>>>      SERVER FILTER BY WTS IS NOT NULL
>>
>>
>> Is this the expected behaviour? Or could this be an issue with 4.4
>> version?
>>
>> Thank you
>> Cheers
>> Pedro
>>
>
>

Re: Local Indexes are not used to query views

Posted by James Taylor <ja...@apache.org>.
Thanks for reporting this, Pedro. I tried it on 4.7-SNAPSHOT and it works
for non local indexes, but not for local indexes. Please file a JIRA.

   James

On Thu, Jan 14, 2016 at 8:34 AM, Pedro Gandola <pe...@gmail.com>
wrote:

> Hi,
>
> I've noticed that Phoenix (using version 4.4) when querying a view it does
> not consider the original table local indexes to optimise the query.
>
> If I explain my query over the original table it's using the local index
> properly:
>
> *EXPLAIN SELECT * FROM BIDDING_EVENTS WHERE wTs IS NOT NULL;*
>> CLIENT 300-CHUNK PARALLEL 300-WAY RANGE SCAN OVER
>> _LOCAL_IDX_BIDDING_EVENTS [-32768]
>>      SERVER FILTER BY "WTS" IS NOT NULL
>
>
> However, If I create a view using the exact same query and explain I get a
> full scan.
>
>
>> *CREATE VIEW WINS_VIEW AS SELECT * FROM BIDDING_EVENTS WHERE wTs IS NOT
>> NULL; *
>
> *EXPLAIN SELECT * FROM WINS_VIEW;*
>> CLIENT 300-CHUNK PARALLEL 1-WAY FULL SCAN OVER BIDDING_EVENTS
>>      SERVER FILTER BY WTS IS NOT NULL
>
>
> Is this the expected behaviour? Or could this be an issue with 4.4 version?
>
> Thank you
> Cheers
> Pedro
>