phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PHOENIX-4288) Indexes not used when ordering by primary key
Date Tue, 28 Nov 2017 02:01:00 GMT

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

ASF GitHub Bot commented on PHOENIX-4288:
-----------------------------------------

Github user JamesRTaylor commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/281#discussion_r153377074
  
    --- Diff: phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java
---
    @@ -0,0 +1,176 @@
    +package org.apache.phoenix.end2end;
    +
    +import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
    +import static org.junit.Assert.assertTrue;
    +
    +import java.sql.Connection;
    +import java.sql.DriverManager;
    +import java.sql.PreparedStatement;
    +import java.sql.ResultSet;
    +import java.util.Map;
    +import java.util.Properties;
    +
    +import org.apache.phoenix.query.BaseTest;
    +import org.apache.phoenix.query.QueryServices;
    +import org.apache.phoenix.util.PropertiesUtil;
    +import org.apache.phoenix.util.QueryUtil;
    +import org.apache.phoenix.util.ReadOnlyProps;
    +import org.junit.AfterClass;
    +import org.junit.BeforeClass;
    +import org.junit.Test;
    +
    +import com.google.common.collect.Maps;
    +
    +public class CostBasedDecisionIT extends BaseTest {
    +
    +    @BeforeClass
    +    public static void doSetup() throws Exception {
    +        Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
    +        props.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(20));
    +        props.put(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, Long.toString(5));
    +        props.put(QueryServices.USE_STATS_FOR_PARALLELIZATION, Boolean.toString(true));
    +        props.put(QueryServices.COST_BASED_OPTIMIZER_ENABLED, Boolean.toString(true));
    +        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
    +    }
    +
    +    @AfterClass
    +    public static void tearDownMiniCluster() throws Exception {
    --- End diff --
    
    This method shouldn't be necessary


> Indexes not used when ordering by primary key
> ---------------------------------------------
>
>                 Key: PHOENIX-4288
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4288
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Marcin Januszkiewicz
>            Assignee: Maryann Xue
>              Labels: CostBasedOptimization
>
> We have a table
> CREATE TABLE t (
>   rowkey VARCHAR PRIMARY KEY,
>   c1 VARCHAR,
>   c2 VARCHAR
> )
> which we want to query by doing partial matches on c1, and keep the ordering of the source
table:
> SELECT rowkey, c1, c2 FROM t where c1 LIKE 'X0%' ORDER BY rowkey;
> We expect most queries to select a small subset of the table, so we create an index to
speed up searches:
> CREATE LOCAL INDEX t_c1_ix ON t (c1);
> However, this index will not be used since Phoenix will always choose not to resort the
data.
> In our actual use case, adding index hints is not a practical solution.
> See also discussion at:
> https://lists.apache.org/thread.html/26ab58288eb811d2f074c3f89067163d341e5531fb581f3b2486cf43@%3Cuser.phoenix.apache.org%3E



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message