From dev-return-51106-archive-asf-public=cust-asf.ponee.io@phoenix.apache.org Fri Apr 20 20:39:08 2018 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 E00D118076D for ; Fri, 20 Apr 2018 20:39:07 +0200 (CEST) Received: (qmail 43572 invoked by uid 500); 20 Apr 2018 18:39:07 -0000 Mailing-List: contact dev-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 dev@phoenix.apache.org Received: (qmail 43561 invoked by uid 99); 20 Apr 2018 18:39:06 -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; Fri, 20 Apr 2018 18:39:06 +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 77C4D18035D for ; Fri, 20 Apr 2018 18:39:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.51 X-Spam-Level: X-Spam-Status: No, score=-109.51 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, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=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 9CWkdnHWONsW for ; Fri, 20 Apr 2018 18:39:05 +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 A18805FBFB for ; Fri, 20 Apr 2018 18:39:03 +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 3CA99E120A for ; Fri, 20 Apr 2018 18:39:02 +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 36A17241D6 for ; Fri, 20 Apr 2018 18:39:01 +0000 (UTC) Date: Fri, 20 Apr 2018 18:39:01 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@phoenix.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (PHOENIX-4666) Add a subquery cache that persists beyond the life of a query 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-4666?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16= 446184#comment-16446184 ]=20 ASF GitHub Bot commented on PHOENIX-4666: ----------------------------------------- Github user maryannxue commented on a diff in the pull request: https://github.com/apache/phoenix/pull/298#discussion_r183133375 =20 --- Diff: phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCo= mpiler.java --- @@ -314,7 +314,8 @@ protected QueryPlan compileJoinQuery(JoinCompiler.S= trategy strategy, StatementCo if (i < count - 1) { fieldPositions[i + 1] =3D fieldPositions[i] + = (tables[i] =3D=3D null ? 0 : (tables[i].getColumns().size() - tables[i].get= PKColumns().size())); } - hashPlans[i] =3D new HashSubPlan(i, subPlans[i], o= ptimized ? null : hashExpressions, joinSpec.isSingleValueOnly(), keyRangeLh= sExpression, keyRangeRhsExpression); + boolean usePersistentCache =3D joinTable.getStatem= ent().getHint().hasHint(Hint.USE_PERSISTENT_CACHE); --- End diff -- =20 We can make "usePersistentCache" a member of QueryCompiler and initiali= ze it in the beginning just like "noChildParentJoinOptimization". > Add a subquery cache that persists beyond the life of a query > ------------------------------------------------------------- > > Key: PHOENIX-4666 > URL: https://issues.apache.org/jira/browse/PHOENIX-4666 > Project: Phoenix > Issue Type: Improvement > Reporter: Marcell Ortutay > Assignee: Marcell Ortutay > Priority: Major > > The user list thread for additional context is here: [https://lists.apach= e.org/thread.html/e62a6f5d79bdf7cd238ea79aed8886816d21224d12b0f1fe9b6bb075@= %3Cuser.phoenix.apache.org%3E] > ---- > A Phoenix query may contain expensive subqueries, and moreover those expe= nsive subqueries may be used across multiple different queries. While whole= result caching is possible at the application level, it is not possible to= cache subresults in the application. This can cause bad performance for qu= eries in which the subquery is the most expensive part of the query, and th= e application is powerless to do anything at the query level. It would be g= ood if Phoenix provided a way to cache subquery results, as it would provid= e a significant performance gain. > An illustrative example: > =C2=A0 =C2=A0 SELECT * FROM table1 JOIN (SELECT id_1=C2=A0FROM=C2=A0large= _table WHERE x =3D 10) expensive_result ON table1.id_1 =3D expensive_result= .id_2 AND table1.id_1 =3D \{id} > In this case,=C2=A0the subquery "expensive_result" is expensive to comput= e, but it doesn't change between queries. The rest of the query does becaus= e of the \{id} parameter. This means the application can't cache it, but it= would be good if there was a way to cache=C2=A0expensive_result. > Note that there is currently a coprocessor based "server cache", but the = data in this "cache" is not persisted across queries. It is deleted after a= TTL expires (30sec by default), or when the query completes. > This is issue is fairly high priority for us at 23andMe and we'd be happy= to provide a patch with some guidance from Phoenix maintainers. We are cur= rently putting together a design document for a solution, and we'll post it= to this Jira ticket for review in a few days. -- This message was sent by Atlassian JIRA (v7.6.3#76005)