You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "Istvan Toth (Jira)" <ji...@apache.org> on 2023/05/18 09:05:00 UTC

[jira] [Commented] (PHOENIX-6959) Hinted uncovered indexes are not used for wildcard selects

    [ https://issues.apache.org/jira/browse/PHOENIX-6959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17723858#comment-17723858 ] 

Istvan Toth commented on PHOENIX-6959:
--------------------------------------

Interestingly, GlobalIndexOptimizationIT checks for something similar, but doesn't hit this bug.

> Hinted uncovered indexes are not used for wildcard selects
> ----------------------------------------------------------
>
>                 Key: PHOENIX-6959
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6959
>             Project: Phoenix
>          Issue Type: Bug
>          Components: phoenix
>    Affects Versions: 5.2.0, 5.1.3
>            Reporter: Istvan Toth
>            Priority: Major
>
> When selecting all columns by specifying '*', Phoenix performs a full table scan.
> Selecting all columns by specifying each one individually, Phoenix uses the uncovered index as intended.
> {noformat}
> create table data_table (k integer primary key, v1 integer, v2 integer, v3 integer, v4 integer);
> create index uncovered on data_table (v1);
> explain select /*+ INDEX(data_table uncovered) */ k,v1,v2,v3,v4 from data_table where v1=1;
> +-------------------------------------------------------------------------+----------------+---------------+-------------+
> |                                  PLAN                                   | EST_BYTES_READ | EST_ROWS_READ | EST_INFO_TS |
> +-------------------------------------------------------------------------+----------------+---------------+-------------+
> | CLIENT 1-CHUNK PARALLEL 1-WAY ROUND ROBIN RANGE SCAN OVER UNCOVERED [1] | null           | null          | null        |
> |     SERVER MERGE [0.V2, 0.V3, 0.V4]                                     | null           | null          | null        |
> |     SERVER FILTER BY FIRST KEY ONLY                                     | null           | null          | null        |
> +-------------------------------------------------------------------------+----------------+---------------+-------------+
> 3 rows selected (0.011 seconds)
> 0: jdbc:phoenix:localhost:49653> explain select /*+ INDEX(data_table uncovered) */ * from data_table where v1=1;
> +---------------------------------------------------------------------------------+----------------+---------------+-------------+
> |                                      PLAN                                       | EST_BYTES_READ | EST_ROWS_READ | EST_INFO_TS |
> +---------------------------------------------------------------------------------+----------------+---------------+-------------+
> | CLIENT 1-CHUNK PARALLEL 1-WAY ROUND ROBIN FULL SCAN OVER DATA_TABLE             | null           | null          | null        |
> |     SKIP-SCAN-JOIN TABLE 0                                                      | null           | null          | null        |
> |         CLIENT 1-CHUNK PARALLEL 1-WAY ROUND ROBIN RANGE SCAN OVER UNCOVERED [1] | null           | null          | null        |
> |             SERVER FILTER BY FIRST KEY ONLY                                     | null           | null          | null        |
> |     DYNAMIC SERVER FILTER BY "DATA_TABLE.K" IN ($183.$185)                      | null           | null          | null        |
> +---------------------------------------------------------------------------------+----------------+---------------+-------------+
> 5 rows selected (0.012 seconds)
> {noformat}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)