Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 33361 invoked from network); 3 Mar 2006 01:33:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Mar 2006 01:33:25 -0000 Received: (qmail 31093 invoked by uid 500); 3 Mar 2006 01:34:11 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 31046 invoked by uid 500); 3 Mar 2006 01:34:11 -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 31031 invoked by uid 99); 3 Mar 2006 01:34:11 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Mar 2006 17:34:11 -0800 X-ASF-Spam-Status: No, hits=1.9 required=10.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [32.97.182.145] (HELO e5.ny.us.ibm.com) (32.97.182.145) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Mar 2006 17:34:09 -0800 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e5.ny.us.ibm.com (8.12.11/8.12.11) with ESMTP id k231XjI8019743 for ; Thu, 2 Mar 2006 20:33:45 -0500 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay04.pok.ibm.com (8.12.10/NCO/VER6.8) with ESMTP id k231XjnF154494 for ; Thu, 2 Mar 2006 20:33:45 -0500 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.12.11/8.13.3) with ESMTP id k231XjXC017472 for ; Thu, 2 Mar 2006 20:33:45 -0500 Received: from [127.0.0.1] (svl-arbrown.svl.ibm.com [9.30.38.112]) by d01av02.pok.ibm.com (8.12.11/8.12.11) with ESMTP id k231XhhU017397 for ; Thu, 2 Mar 2006 20:33:45 -0500 Message-ID: <44079CF6.6060204@sbcglobal.net> Date: Thu, 02 Mar 2006 17:33:42 -0800 From: Army User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.1) Gecko/20040707 X-Accept-Language: en-us, en MIME-Version: 1.0 To: derby-dev@db.apache.org Subject: Re: [OPTIMIZER] Optimizer "timeout" for subqueries? References: <44079238.90307@sbcglobal.net> In-Reply-To: <44079238.90307@sbcglobal.net> Content-Type: text/plain; charset=us-ascii; format=flowed 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 Army wrote: > This hasn't really been an issue to date because the "best plan" chosen > by the subquery is typically independent of the outer query's current > permutation--with the exception of "outerCost", which is passed in from > the outer query and is factored into the subquery's cost estimates. > Because of this relative independence, the plan chosen by the subquery > would rarely (if ever?) change with different permutations of the outer > query, so if the subquery timed out once there was no point in trying to > re-optimize it again later. > > With my changes for DERBY-805, though, I'm introducing the notion of > pushing predicates from outer queries down into subqueries--which means > that the outer join order can have a very significant impact on the plan > chosen by the subquery. After re-reading what I wrote, I realized we have a basis for logic to only reset the timeout state when it could potentially be beneficial to do so--i.e. when we have predicates pushed from the outer query. I could add logic to check to see if the OptimizerImpl has predicates from outer queries and, if so, then reset the timeout state; otherwise, since the subquery's "best plan" probably won't change much from the previous round, we would leave the timeout state as it is. This approach allows the optimizer to consider plans that use pushed predicates while at the same time reducing the likelihood that queries which have timed out in the past (prior to 10.2) would now take longer to compile. I'll code that up and run derbyall tonight; in the meantime, I'd still like to hear comments/suggestions from any readers out there... Thanks, Army