[ 
https://issues.apache.org/jira/browse/PHOENIX-2597?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pedro Gandola updated PHOENIX-2597:
-----------------------------------
    Description: 
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:

{code:sql}
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
{code}

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

{code:sql}
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
{code}

Version 4.7-SNAPSHOT is affected as well.

  was:
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:

{code:sql}
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
{code}

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

{code:sql}
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
{code}

Version 4.7 is affected as well.


> Local Indexes are not used to query views
> -----------------------------------------
>
>                 Key: PHOENIX-2597
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2597
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.4.0, 4.7.0
>            Reporter: Pedro Gandola
>
> 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:
> {code:sql}
> 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
> {code}
> However, If I create a view using the exact same query and explain I get a 
> full scan.
> {code:sql}
> 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
> {code}
> Version 4.7-SNAPSHOT is affected as well.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to