Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 91583 invoked from network); 11 Feb 2011 22:17:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Feb 2011 22:17:00 -0000 Received: (qmail 14225 invoked by uid 500); 11 Feb 2011 22:17:00 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 14163 invoked by uid 500); 11 Feb 2011 22:16:59 -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 14156 invoked by uid 99); 11 Feb 2011 22:16:59 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Feb 2011 22:16:59 +0000 X-ASF-Spam-Status: No, hits=-1.6 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [148.87.113.121] (HELO rcsinet10.oracle.com) (148.87.113.121) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Feb 2011 22:16:49 +0000 Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id p1BMGPDY031713 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 11 Feb 2011 22:16:27 GMT Received: from acsmt355.oracle.com (acsmt355.oracle.com [141.146.40.155]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id p1BMGNSv002917 for ; Fri, 11 Feb 2011 22:16:23 GMT Received: from abhmt002.oracle.com by acsmt354.oracle.com with ESMTP id 1047027371297462509; Fri, 11 Feb 2011 14:15:09 -0800 Received: from [192.168.1.41] (/88.89.57.81) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 11 Feb 2011 14:15:08 -0800 Message-ID: <4D55A6B5.3050403@apache.org> Date: Fri, 11 Feb 2011 22:14:29 +0100 From: Kristian Waagan User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.13) Gecko/20110117 Thunderbird/3.1.7 MIME-Version: 1.0 To: derby-dev@db.apache.org Subject: Re: question about istats thresholds References: <4D5589F2.50600@sbcglobal.net> In-Reply-To: <4D5589F2.50600@sbcglobal.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Source-IP: acsmt355.oracle.com [141.146.40.155] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090207.4D55B538.0033,ss=1,fgs=0 X-Virus-Checked: Checked by ClamAV on apache.org On 11.02.11 20:11, Mike Matrigali wrote: > From DERBY-4934 i see there are the following thresholds: > a) derby.storage.indexStats.debug.createThreshold (100) > b) derby.storage.indexStats.debug.absdiffThreshold (1000) > c) derby.storage.indexStats.debug.lndiffThreshold (1.0) > d) derby.storage.indexStats.debug.queueSize (5) > > > My question is that I don't understand how they are expected to > interact. If a table has less than 100 rows does that mean > stat will not be created even if b or c is exceeded. Hi Mike, To start with, you can probably ignore threshold (d) for now. It applies to the scheduling phase - that is when the unit of work is scheduled with the daemon - and to get that far (at least) one of the other thresholds has to be exceeded. If the queue is full the unit of work won't be scheduled, and another attempt may be made at a later time during another statement compilation. This requires that someone actually compiles a relevant query, or potentially that the existing statement is recompiled (stale plan check). The purpose of (d) is to avoid excessive queue growth. Since the queue is implemented as a list, searching it for duplicates may also be expensive if it grows too large. Threshold (a) concerns indexes without existing statistics. If there are less than 100 rows in the base table, statistics won't be created. Thresholds (b) and (c) concern indexes with existing statistics. Threshold (b) was introduced to avoid too frequent updates of existing statistics for small tables. I don't remember off the top of my head where it was discussed, but I ended up effectively removing it by setting it to zero for now. I kept the property (and the relevant code) to allow people to experiment somewhat without having to recompile the code if they have an application running into trouble with this scenario. Finally, the main threshold for existing statistics is (c). Here the natural logarithms of the row estimate of the index statistics and the row estimate of the base table are compared. If the difference is greater than or equal to lndiffThreshold (defaults to 1.0) the statistics for the index are scheduled for update. If the daemon queue is full the request is discarded, assuming another compilation will manage to schedule the update eventually. Hope this helped a bit, feel free to ask additional questions. As I have said before, these threshold may have to be changed significantly as we test the feature (remove existing, add new ones, or modify existing ones). Cheers, -- Kristian > > I assume if d is exceeded than no stat is created no matter what > a, b, and c are.