From issues-return-4330-archive-asf-public=cust-asf.ponee.io@phoenix.apache.org Thu Jan 31 01:34:14 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 719B3180652 for ; Thu, 31 Jan 2019 02:34:13 +0100 (CET) Received: (qmail 3594 invoked by uid 500); 31 Jan 2019 01:34:12 -0000 Mailing-List: contact issues-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list issues@phoenix.apache.org Received: (qmail 3582 invoked by uid 99); 31 Jan 2019 01:34:12 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Jan 2019 01:34:12 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 19BC11818C2 for ; Thu, 31 Jan 2019 01:34:12 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id y6Ri9qIlI8TC for ; Thu, 31 Jan 2019 01:34:10 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 780865FAC8 for ; Thu, 31 Jan 2019 01:26:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 919AEE265B for ; Thu, 31 Jan 2019 01:26:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 4A04F243BE for ; Thu, 31 Jan 2019 01:26:00 +0000 (UTC) Date: Thu, 31 Jan 2019 01:26:00 +0000 (UTC) From: "Lars Hofhansl (JIRA)" To: issues@phoenix.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (PHOENIX-5109) Allow local indexes to work for queries with uncovered columns. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/PHOENIX-5109?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16= 756764#comment-16756764 ]=20 Lars Hofhansl edited comment on PHOENIX-5109 at 1/31/19 1:25 AM: ----------------------------------------------------------------- This just does not end. Now there's a special case for the following: # compound key of VARCHAR # SELECT DISTINCT # Salting is enabled # There is a local index on an unrelated column Now Phoenix selects a full local index scan, which is heuristically less ef= ficient... I think. was (Author: lhofhansl): This just does not end. Now there's a special case for the following: # compound key of VARCHAR # SELECT DISTINCT # Salting is enabled # There is a local index Now Phoenix selects the local index, which is heuristically less efficient.= .. I think. > Allow local indexes to work for queries with uncovered columns. > --------------------------------------------------------------- > > Key: PHOENIX-5109 > URL: https://issues.apache.org/jira/browse/PHOENIX-5109 > Project: Phoenix > Issue Type: Bug > Affects Versions: 4.14.1 > Reporter: Lars Hofhansl > Assignee: Lars Hofhansl > Priority: Major > Fix For: 4.15.0 > > Attachments: 5109-addendum.txt, 5109-addendum2.txt, 5109-v1.txt, = 5109-v2.txt, 5109-v3.txt, 5109-v4-master.txt > > > This change allows local indexes to be used for a wide set of queries whe= re not all columns are covered. > See scenarios in the test case attached with the patch. > This is important for various reasons: > # Unlike global indexes, local indexes can support a wide range case whe= re the queries are not covered. > # Indexes that cover only the indexed columns are much friendlier to sch= ema changes. (changes to any extra included column cause a need to rebuild = these indexes) > # A lot of storage is saved. The same is true for read and write IO. > (Of course uncovered columns have disadvantages too, Phoenix needs to rea= ssemble the complete row in those cases.) > =E2=80=94 > Was: > Example: > {{create table test (pk integer primary key, v1 float, v2 float, v3 inte= ger);}} > {{create local index l1 on test(v1);}} > {{select /*+ INDEX(test l1) */ * from test where v2 =3D 1;}} > {code:java} > 0: jdbc:phoenix:localhost> select /*+ INDEX(test l1) */ * from test where= v2 =3D 1; > Error: ERROR 504 (42703): Undefined column. columnName=3DTEST.V2 (state= =3D42703,code=3D504) > org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): Und= efined column. columnName=3DTEST.V2 > =09at org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.re= solveColumn(WhereCompiler.java:202) > =09at org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.vi= sit(WhereCompiler.java:177) > =09at org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.vi= sit(WhereCompiler.java:164) > =09at org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.jav= a:56) > =09at org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundP= arseNode.java:64) > =09at org.apache.phoenix.parse.CastParseNode.accept(CastParseNode.java:60= ) > =09at org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundP= arseNode.java:64) > =09at org.apache.phoenix.parse.ComparisonParseNode.accept(ComparisonParse= Node.java:45) > =09at org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java= :138) > =09at org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java= :108) > =09at org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(Que= ryCompiler.java:559) > =09at org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCo= mpiler.java:510) > =09at org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompile= r.java:195) > =09at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java= :155) > =09at org.apache.phoenix.compile.QueryCompiler.compileSubquery(QueryCompi= ler.java:499) > =09at org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryComp= iler.java:221) > =09at org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryComp= iler.java:295) > =09at org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryComp= iler.java:230) > =09at org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompile= r.java:193) > =09at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java= :155) > =09at org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.j= ava:399) > =09at org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(Query= Optimizer.java:279) > =09at org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlansForSin= gleFlatQuery(QueryOptimizer.java:220) > =09at org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(Query= Optimizer.java:133) > =09at org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.= java:111) > =09at org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.= java:97) > =09at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.ja= va:309) > =09at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.ja= va:291) > =09at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53) > =09at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatem= ent.java:290) > =09at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatem= ent.java:283) > =09at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.j= ava:1830) > =09at sqlline.Commands.execute(Commands.java:822) > =09at sqlline.Commands.sql(Commands.java:732) > =09at sqlline.SqlLine.dispatch(SqlLine.java:813) > =09at sqlline.SqlLine.begin(SqlLine.java:686) > =09at sqlline.SqlLine.start(SqlLine.java:398) > =09at sqlline.SqlLine.main(SqlLine.java:291) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)