Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id D9B3E6352C2 for ; Wed, 3 Mar 2010 13:12:56 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 45913-05 for ; Wed, 3 Mar 2010 17:12:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-bw0-f216.google.com (mail-bw0-f216.google.com [209.85.218.216]) by mail.postgresql.org (Postfix) with ESMTP id 31A3C633167 for ; Wed, 3 Mar 2010 13:12:41 -0400 (AST) Received: by bwz8 with SMTP id 8so1372915bwz.3 for ; Wed, 03 Mar 2010 09:12:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=mvTNOEYxVG1M4srD9gQZx80VNwYK6IiSWiP+0YMw0NQ=; b=rYiafzKb6l27iH9nA1unQDKebGWlYExxcO12bElXX+Da6OgPwXfz1BXGSBHsAzQbe+ NNvuquoFfPBAgGRfOi6bSBMb0EK3JwEuN9Z+Ic73Hy6gNxHTauGR+pVNbNbRCneemDIV LpGPHqPoAP99GUYsFPez0Mc5NVhTmF2excK/A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=kvi7OjYijrL4c7j+TlZkfMnD7SFq5F/cYx9EYy0HgWeB3bPMqshd47MlZ/Z7ZOahwz 5giojhrRKTlOL/1lvqLFJoEUiCGSy9su1s//Bt5JcDDLniz55QCbl+Uo61527y/H8Ymb VPsLs5WTvYC6EDJ1uxXwfdOuCNAwTKsmqlL0c= MIME-Version: 1.0 Received: by 10.239.183.147 with SMTP id u19mr758049hbg.106.1267636360784; Wed, 03 Mar 2010 09:12:40 -0800 (PST) In-Reply-To: <4B8ACFE7.6040207@agliodbs.com> References: <4B8ACFE7.6040207@agliodbs.com> Date: Wed, 3 Mar 2010 12:12:40 -0500 Message-ID: <603c8f071003030912k5750abadif64cb36d67ab99ae@mail.gmail.com> Subject: Re: Estimation issue with partitioned tables From: Robert Haas To: Josh Berkus Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.403 tagged_above=-10 required=5 tests=AWL=0.040, BAYES_00=-2.599, SUBJECT_FUZZY_TION=0.156 X-Spam-Level: X-Archive-Number: 201003/62 X-Sequence-Number: 37887 On Sun, Feb 28, 2010 at 3:19 PM, Josh Berkus wrote: > All, > > I'm seeing in a production database two problems with query rowcount > estimation: > > (1) Estimates for the number of rows in an outer join do not take into > account any constraint exclusion (CE) in operation. > > (2) Row estimates do not take into account if the unique indexes on the > child partitions are different from the master partition (the append > node). =A0This is often true, because the key to the master is ( key, ce > column) and for the children is just ( key ). > > The result is that if you do a series of outer joins using the CE > criterion against partitioned tables, the row estimates you get will be > several orders of magnitude too high ... and the subsequent query plan > far too pessimistic. > > Anyone else seeing this? =A0Do any of the 9.0 patches address the above > issues? I feel like I've seen these way-too-high row estimates in some other postings to -performance, but I'm not sure if it was the same issue. You don't by chance have a RTC? I don't think it's likely fixed in 9.0 but it would be interesting to investigate. ...Robert