Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 488982E0079 for ; Mon, 2 Jun 2008 20:38:28 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 90104-08 for ; Mon, 2 Jun 2008 20:38:18 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.224]) by developer.postgresql.org (Postfix) with ESMTP id 3F1CF2E0072 for ; Mon, 2 Jun 2008 20:38:23 -0300 (ADT) Received: by rv-out-0506.google.com with SMTP id b25so1342813rvf.43 for ; Mon, 02 Jun 2008 16:38:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=jbAk5wAB85LAGENi55ZXrohbdZs0V6qrQxI6M2VhFQU=; b=YlWkoBVpuqtaNCUD+aUkG4KOPfVODGNy7aNLOyBXRTCTeGmoBdwK07U2IWEcAMGqa+3yAxkyYWDOLYweq1/fxucnpyuJPN5LsxP3ussY7whF9bExXm7VpwbUcWPnuTbv4b6y4xlcjM3ERf2tOshpc8OXvI8KycUZ0+PNDs8XFsE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=JS/Q5e9ezxznA0TYja1gS74PJ3gV4URWZqse7GFCLNRTYrHL1/evZtLLyPVNgzVOcl/5DsIvyG+UhSxm5sJX2AGsGoXs+f+oaOpe+kRM5mrG0YjZMUKi+waZd2XxkOkGXIhSZkbC/tk9f/y8W6AhADvvm5/nO7kAa+JSJPD5M1o= Received: by 10.114.168.1 with SMTP id q1mr10443805wae.72.1212449901607; Mon, 02 Jun 2008 16:38:21 -0700 (PDT) Received: by 10.114.130.17 with HTTP; Mon, 2 Jun 2008 16:38:21 -0700 (PDT) Message-ID: Date: Mon, 2 Jun 2008 17:38:21 -0600 From: "Scott Marlowe" To: Justin Subject: Re: getting estimated cost to agree with actual Cc: "pgsql-performance@postgresql.org" In-Reply-To: <4844696D.20307@emproshunts.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4844696D.20307@emproshunts.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200806/5 X-Sequence-Number: 30355 On Mon, Jun 2, 2008 at 3:43 PM, Justin wrote: > As i've been looking over the more complicated queries that i have written > and gotten allot of help in redoing the quires from you all, thanks again. > > I have noticed that estimated Cost to do the query is way off from Actual. > The queries don't run slow at least not to me. The Estimated Cost is way > higher than the actual time on Hash joins but on the scan through the tables > the Estimate Cost to Actual flips where Actual is way higher than Estimated > Cost > > I have tried increasing and decreasing the Stats on the important columns > with no changes Well, they're not measured in the same units. estimated costs are in terms of the cost to sequentially scan a single tuple, while actual costs are in milliseconds. You might be able to change the cost of sequential scan from 1 to something else and everything else to reflect that change to get them close. But they aren't supposed to match directly up.