Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 57E701336DB6 for ; Thu, 28 Oct 2010 18:07:13 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 27677-03 for ; Thu, 28 Oct 2010 21:07:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-yw0-f46.google.com (mail-yw0-f46.google.com [209.85.213.46]) by mail.postgresql.org (Postfix) with ESMTP id A976A13364DE for ; Thu, 28 Oct 2010 18:07:05 -0300 (ADT) Received: by ywk9 with SMTP id 9so1612554ywk.19 for ; Thu, 28 Oct 2010 14:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:mime-version :content-type:from:in-reply-to:date:cc:content-transfer-encoding :message-id:references:to:x-mailer; bh=ekjfeKnXS96rlYCDSI/PJMHQIgOJCnF5JCJSteGo9h0=; b=sHJJdltLeU70EmPqTwZ1+HiDEuzgbCi7nxyGcm8g/IzOVuPzhelDRNwBfhd/uhTS2M wLLIdCVFH32ZxpUabxIcZYEHX9o30cFfpaGvu/C4Y0bm+FhnveREx1vtVU/aZN5ExXyJ HS7yhWnxeNmAohLVvypMAWDYzS8VSPvy9oCZ0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=id6nQPEZ0AYIGCGGl4IkduKFOJ62iFaI8xAtKP/CKzWsrAOKqUjcTRAcvOaj/MdAdc 26RvWEMGqB4jn7XnXiT5eWtYl1OP3xStYY0UjA5qLudGeijcU4y6l70qko5/oVbrTBeu sNiTJlYney16A/Edkl4B+NxkcoDxx5HbhLjWM= Received: by 10.100.96.14 with SMTP id t14mr9503795anb.269.1288300024696; Thu, 28 Oct 2010 14:07:04 -0700 (PDT) Received: from [192.168.1.106] (74-95-195-236-SFBA.hfc.comcastbusiness.net [74.95.195.236]) by mx.google.com with ESMTPS id 6sm1579759anx.32.2010.10.28.14.06.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 28 Oct 2010 14:07:00 -0700 (PDT) Subject: Re: partitioning question 1 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Ben In-Reply-To: <1288298912.22359.46.camel@jd-desktop> Date: Thu, 28 Oct 2010 14:06:57 -0700 Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <060B905E-0A4A-4341-9E9F-05CFE15CF71C@gmail.com> References: <1288287092.22359.23.camel@jd-desktop> <1288291814.22359.31.camel@jd-desktop> <4486C61F-DC08-4DE4-8AF9-245FA60B0310@gmail.com> <1288295052.22359.35.camel@jd-desktop> <73315FB7-240B-480C-9200-D547BCA942DE@gmail.com> <1288298912.22359.46.camel@jd-desktop> To: jd@commandprompt.com X-Mailer: Apple Mail (2.1081) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201010/563 X-Sequence-Number: 40981 whoops, didn't see the i=3D9 (linebreak! linebreak!) nonetheless that is a static constant constraint on the column i, and i = was asking if constraint exclusions would work for dynamic constraints = (like those derived from a table joined against.) so for example the = bar table has only 0-9 in its histogram for i, but constraint exclusion = can't use that to eliminate tables foo_2 and foo_3. this is precisely = the kind of information an index can use via join selectivity. i am not going to the pg conference, sorry to say. b On Oct 28, 2010, at 1:48 PM, Joshua D. Drake wrote: > On Thu, 2010-10-28 at 12:59 -0700, Ben wrote: >> On Oct 28, 2010, at 12:44 PM, Joshua D. Drake wrote: >>>=20 >>> My tests show you are incorrect: >>>=20 >>>=20 >>> part_test=3D# explain analyze select * from foo join bar using (i) = where >>> i=3D9; >>> QUERY >>> PLAN =20 >>> = --------------------------------------------------------------------------= ---------------------------------------- >>> Nested Loop (cost=3D34.26..106.76 rows=3D200 width=3D20) (actual >>> time=3D0.004..0.004 rows=3D0 loops=3D1) >>> -> Append (cost=3D0.00..68.50 rows=3D20 width=3D12) (actual >>> time=3D0.004..0.004 rows=3D0 loops=3D1) >>> -> Seq Scan on foo (cost=3D0.00..34.25 rows=3D10 width=3D12) >>> (actual time=3D0.001..0.001 rows=3D0 loops=3D1) >>> Filter: (i =3D 9) >>> -> Seq Scan on foo_1 foo (cost=3D0.00..34.25 rows=3D10 = width=3D12) >>> (actual time=3D0.000..0.000 rows=3D0 loops=3D1) >>> Filter: (i =3D 9) >>> -> Materialize (cost=3D34.26..34.36 rows=3D10 width=3D12) (never >>> executed) >>> -> Seq Scan on bar (cost=3D0.00..34.25 rows=3D10 width=3D12) = (never >>> executed) >>> Filter: (i =3D 9) >>> Total runtime: 0.032 ms >>> (10 rows) >>=20 >> strange. my tests don't agree with your tests : >=20 > Do you have constraint_exclusion turned on? You should verify with = show > constraint_exclusion (I saw what you wrote below). >=20 > JD >=20 > P.S. Blatant plug, you coming to http://www.postgresqlconference.org ? >=20 >=20 > --=20 > PostgreSQL.org Major Contributor > Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579 > Consulting, Training, Support, Custom Development, Engineering > http://twitter.com/cmdpromptinc | http://identi.ca/commandprompt >=20