Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 57225 invoked from network); 28 Apr 2006 02:45:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Apr 2006 02:45:05 -0000 Received: (qmail 17943 invoked by uid 500); 28 Apr 2006 02:45:04 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 17917 invoked by uid 500); 28 Apr 2006 02:45:03 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 17908 invoked by uid 99); 28 Apr 2006 02:45:03 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Apr 2006 19:45:03 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Apr 2006 19:45:03 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id BAF937142C5 for ; Fri, 28 Apr 2006 02:44:38 +0000 (GMT) Message-ID: <19560715.1146192278762.JavaMail.jira@brutus> Date: Fri, 28 Apr 2006 02:44:38 +0000 (GMT+00:00) From: "Satheesh Bandaram (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-805) Push join predicates into union and other set operations. DERBY-649 implemented scalar (single table) predicate pushdown. Adding join predicate push down could improve performance significantly. In-Reply-To: <688763290.1136837782912.JavaMail.jira@ajax.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DERBY-805?page=comments#action_12376859 ] Satheesh Bandaram commented on DERBY-805: ----------------------------------------- I have committed this patch to 10.1 branch. Thanks for pulling all relavent checkins. > Push join predicates into union and other set operations. DERBY-649 implemented scalar (single table) predicate pushdown. Adding join predicate push down could improve performance significantly. > -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: DERBY-805 > URL: http://issues.apache.org/jira/browse/DERBY-805 > Project: Derby > Type: Sub-task > Components: SQL > Versions: 10.1.2.0, 10.2.0.0 > Environment: generic > Reporter: Satheesh Bandaram > Assignee: A B > Fix For: 10.2.0.0 > Attachments: DERBY-805.html, DERBY-805_v2.html, DERBY-805_v3.html, DERBY-805_v4.html, DERBY-805_v5.html, d805_1007_1073_portTo10_1.patch, d805_1007_1073_portTo10_1.stat, d805_followup_v1.patch, d805_phase1_v1.patch, d805_phase1_v1.stat, d805_phase1_v2.patch, d805_phase1_v2.stat, d805_phase1_v3.patch, d805_phase1_v3.stat, d805_phase2_v1.patch, d805_phase2_v1.stat, d805_phase3_v1.patch, d805_phase3_v1.stat, d805_phase4_v1.patch, d805_phase4_v1.stat, d805_phase4_v2.patch, phase2_javadocFix.patch, predPushdown_testFix.patch, test_805.htm > > Fix for DERBY-649 implemented scalar (single table) predicate push down into UNIONs. While this improves performance for one set of queries, ability to push join-predicates further improves Derby performance by enabling use of indices where possible. > For example, > create view V1 as select i, j from T1 union all select i,j from T2; > create view V2 as select a,b from T3 union all select a,b from T4; > insert into T1 values (1,1), (2,2), (3,3), (4,4), (5,5); > For a query like > select * from V1, V2 where V1.j = V2.b and V1.i =1; > If the join order choosen is V1,V2, V1 can use index on V1.i (if present) following fix for DERBY-649. But if there is a index on V2.b also, Derby currently can't use that index. By pushing join predicate, Derby would be able to use the index and improve performance. Some of the queries I have seen (not the one shown here...) could improve from 70-120 seconds to about one second. > Note there is a good comment by Jeff Lichtman about join-predicate push down. I am copying parts of it here for completeness of this report: (Modified) > If predicate push down is done during optimization, it would be possible to push joins into the union as long as it's in the right place in the join order. > For example: > create view v as select * from t1 union all select * from t2; > select * from v, t3 where v.c1 = t3.c2; > In this select, if t3 is the outer table then the qualification could be pushed into the union and optimized there, but if t3 is the inner table the qualification can't be pushed into the union. > If the pushing is done at preprocess time (i.e. before optimization) it is impossible to know whether a join qualification like this can be safely pushed. > There's a comment in UnionNode.optimizeIt() saying: > /* RESOLVE - don't try to push predicated through for now */ > This is where I'd expect to see something for pushing predicates into the union during optimization. > BTW, the business of pushing and pulling predicates during optimization can be hard to understand and debug, so maybe it's best to only handle the simple cases and do it during preprocessing. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira