Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 26530 invoked from network); 19 Nov 2010 15:33:43 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 19 Nov 2010 15:33:43 -0000 Received: (qmail 51802 invoked by uid 500); 19 Nov 2010 15:34:15 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 51690 invoked by uid 500); 19 Nov 2010 15:34:14 -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 51683 invoked by uid 99); 19 Nov 2010 15:34:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Nov 2010 15:34:14 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of bpendleton.derby@gmail.com designates 209.85.210.44 as permitted sender) Received: from [209.85.210.44] (HELO mail-pz0-f44.google.com) (209.85.210.44) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Nov 2010 15:34:05 +0000 Received: by pzk10 with SMTP id 10so1228156pzk.31 for ; Fri, 19 Nov 2010 07:33:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=BdyW4Yd4x9EVWSQaxArF7PoL+XtG+RcQHmrA9/HwYqA=; b=rxpT1wbshy6ZVGepaDcdHTl+aoYBPHMRMhdYHD7xYLnAUX6iuTb+lia9spl5590cpT Xqgo7H9RzT7xsQRj9A0Klhc7yICrQzPrxC07sJ+k/zALEy1cJDZjDghjnwRtOSIyyFxI vgYbINf4oyiBf5bTSvF3V+PjcbWTtRb4XLmKY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=CVdfqsgm1utrXuyB7ymkm9SLOG14GjwPhe61r+hn7Cb2O1Q38ohoxhzEW/1o56Bath M0HJFMvVM7Ic23mr5FBGi2N0RyxGHUJG+upTfSRdyIQNx9PepYCCm8aYcAOm+IYmNDGo 7M0OGgzQ6z/HZvmsl4spfIBZppRmw/snTMRh0= Received: by 10.142.199.18 with SMTP id w18mr1786977wff.326.1290180824026; Fri, 19 Nov 2010 07:33:44 -0800 (PST) Received: from [192.168.0.103] (c-67-170-231-73.hsd1.ca.comcast.net [67.170.231.73]) by mx.google.com with ESMTPS id w14sm2028683wfd.6.2010.11.19.07.33.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 19 Nov 2010 07:33:42 -0800 (PST) Message-ID: <4CE698CF.6010202@gmail.com> Date: Fri, 19 Nov 2010 07:33:35 -0800 From: Bryan Pendleton User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6 MIME-Version: 1.0 To: derby-dev@db.apache.org Subject: Re: [jira] Commented: (DERBY-4908) Instability in CheckConstraintTest.testBuiltInFunctions References: <653749.192911290157274944.JavaMail.jira@thor> <998961.55761.qm@web65706.mail.ac4.yahoo.com> In-Reply-To: <998961.55761.qm@web65706.mail.ac4.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org > I always puzzle about this kind of change. Does this behavior mean the optimizer somehow change so it choose different path? > Hence, the different order result set. Or, optimizer can decide to choose different path in general? Hi Lily, It's a great question, and I think it would be a great topic for the wiki. The optimizer didn't change, but it definitely can decide to choose different paths in general. The optimizer considers a (large) variety of possible query execution plans, and uses an estimation function to compute an estimate of the cost of executing each plan. The optimizer attempts to choose the plan with the lowest cost, by choosing the plan with the lowest estimated cost. There are some additional wrinkles, but that's the high-level view. In terms of ordering, the most common reason for an ordering difference is the difference in behavior between a nested-loops join driven by an index scan, versus a hash join. Plans which scan indexes return the rows in key order, and so the rows tend to be emitted in key order. Plans which perform hash joins can jumble the rows up in an apparently-random order, determined by the hash algorithm. thanks, bryan