X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8D2C352844 for ; Fri, 20 May 2005 17:47:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90267-03 for ; Fri, 20 May 2005 20:47:19 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id D3C305282B for ; Fri, 20 May 2005 17:47:18 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j4KKldbT028983; Fri, 20 May 2005 16:47:39 -0400 (EDT) To: "Jim C. Nasby" Cc: Josh Berkus , pgsql-performance@postgresql.org Subject: Re: Tuning planner cost estimates In-reply-to: <20050520202017.GK44623@decibel.org> References: <20050518002236.GU30902@decibel.org> <200505190931.47662.josh@agliodbs.com> <20050520202017.GK44623@decibel.org> Comments: In-reply-to "Jim C. Nasby" message dated "Fri, 20 May 2005 15:20:17 -0500" Date: Fri, 20 May 2005 16:47:38 -0400 Message-ID: <28982.1116622058@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/335 X-Sequence-Number: 12499 "Jim C. Nasby" writes: > On Thu, May 19, 2005 at 09:31:47AM -0700, Josh Berkus wrote: >> can test our formula for accuracy and precision. However, such a formula >> *does* need to take into account concurrent activity, updates, etc ... that >> is, it needs to approximately estimate the relative cost on a live database, >> not a test one. > Well, that raises an interesting issue, because AFAIK none of the cost > estimate functions currently do that. I'm unconvinced that it'd be a good idea, either. People already complain that the planner's choices change when they ANALYZE; if the current load factor or something like that were to be taken into account then you'd *really* have a problem with irreproducible behavior. It might make sense to have something a bit more static, perhaps a GUC variable that says "plan on the assumption that there's X amount of concurrent activity". I'm not sure what scale to measure X on, nor exactly how this would factor into the estimates anyway --- but at least this approach would maintain reproducibility of behavior. > Another issue is: what state should the buffers/disk cache be in? The current cost models are all based on the assumption that every query starts from ground zero: nothing in cache. Which is pretty bogus in most real-world scenarios. We need to think about ways to tune that assumption, too. Maybe this is actually the same discussion, because certainly one of the main impacts of a concurrent environment is on what you can expect to find in cache. regards, tom lane