Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 69162 invoked from network); 6 Aug 2010 16:07:26 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 6 Aug 2010 16:07:26 -0000 Received: (qmail 17724 invoked by uid 500); 6 Aug 2010 16:07:26 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 17269 invoked by uid 500); 6 Aug 2010 16:07:25 -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 17190 invoked by uid 99); 6 Aug 2010 16:07:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Aug 2010 16:07:25 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [69.147.65.186] (HELO smtp127.sbc.mail.sp1.yahoo.com) (69.147.65.186) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 06 Aug 2010 16:07:18 +0000 Received: (qmail 54722 invoked from network); 6 Aug 2010 16:06:57 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=sbcglobal.net; h=DKIM-Signature:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=yCyMTk0r7SxZ9ESWtq4WhVSCjbxLcHIEwqYLkX1iDywuYr1Yile7ca5iMvQLNKO7pU0J/LilSBHVjDsOJqqDFqyZZ2CkV8in3L7BHWc0pRVOdBY0TQFGb31RasiDhG+4RvyNX871vk5y7KobYhlSUrSDfwDer2M5/tPSWpiBb74= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sbcglobal.net; s=s1024; t=1281110817; bh=S6f1yLElHqtSvmJWEevWuX49zTIk8HRPeBlAIKwoLJc=; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=sr1keQVMZPFbwqDwdgYa9GJlyPMsp+JZ/woPlAXU2vf/MD8AcvQqb1aAv5Lzmp92YiUTRIoZGCFyHOzpn0/ux7SQXYqJqRERtvuK3r5Txa9P9KZrZsObw5ogAB2g9INXBScMDM8iG6Mstw1lBTfEaoCzK+/fmLY9YwA0oxZ+Z3s= Received: from [192.168.1.102] (mikem_app@71.131.185.72 with plain) by smtp127.sbc.mail.sp1.yahoo.com with SMTP; 06 Aug 2010 09:06:57 -0700 PDT X-Yahoo-SMTP: 0mCmWXSswBCWOCMKYdwRsTx1yUFXw1u4Y1Itob3JXDF8Loh0 X-YMail-OSG: 36fbImgVM1mOQFfGFUwPtrTe_TQEagttBeZBQNyp1PumVF9 JcX4qwmNe5VJB82yBEeTnFhXARGSXS1OJ5Wu6stOyagbd0H9Em1han1YOeW1 yOwDr5KnasbPctFqNs4XGhbW.Z7_roXv3mrug5QRMUcbGIaxV5eSt3lSfNcM 29F41fnF4hnjH9JtCf_ffRppvC8mPfdC_osbtyzpoL3LML8vxf6TvBTzmjlj ZQrd4ebmtxt7I6maNiSpxlqBsHimP96TFLfpgw26ReZC.OdaNQiAm4ZCOFNH cp89ax.0g7Arlx7_4Sqbf7TVOYBS66MCE9jeA1FarIl8- X-Yahoo-Newman-Property: ymail-3 Message-ID: <4C5C3320.9090604@sbcglobal.net> Date: Fri, 06 Aug 2010 09:06:56 -0700 From: Mike Matrigali User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: derby-dev@db.apache.org Subject: Re: Transaction contexts and log flushing References: <4C581C29.5060304@oracle.com> <4C5851D6.3020002@sbcglobal.net> <4C586E74.8070009@oracle.com> <4C58849C.4070701@sbcglobal.net> <4C5BE2C3.2070301@oracle.com> In-Reply-To: <4C5BE2C3.2070301@oracle.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Kristian Waagan wrote: > The new stats are stored in the daemon. There is logic in > GenericStatement (at the very end of prepMinion) to go to the daemon to > fetch any new stats if they exists. Although all new stats will be > written at once, the decision on whether to go to the daemon to ask for > new stats is taken based on the statistics needed by the query being > compiled. > > Another issue here is whether doing these checks only at compile time is > good enough. May the system reach a steady state where the stats are > becoming outdated and no queries are (re)compiled? > Ok, now I think I understand the async and how you are using the user thread. I had not considered using subsequent executions to do the system catalog update. I think it would be a little less complicated if we could figure out a way to just let the daemon do the update, but previous attempts did run into problems. I can definitely see cases where we may never compile again in a server session, and it would be sad to do all the work to create the stats and never get them written. I think the most important case to handle is where no stats exist at all. For a table of any significant size stats should not become outdated, and determining if they are outdated may take just as much work as compiling them again. For derby the only stats that we are talking about here is the cardinality - basically how many duplicates per key. static histogram stats are not kept, instead at compile time the actual indexes are used for histogram based costing of key ranges. maybe longer term we can invalidate based on large changes in number of rows, or just date that last statistics were gathered. And really longer term we could invalidate if we figure out during execution that compile time estimate was wrong.