X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 37C529FA38E for ; Wed, 24 May 2006 22:42:09 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 35698-06 for ; Wed, 24 May 2006 22:42:03 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 8ED649FA15F for ; Wed, 24 May 2006 22:42:03 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k4P1fx0S007083; Wed, 24 May 2006 21:41:59 -0400 (EDT) To: kynn@panix.com cc: pgsql-performance@postgresql.org Subject: Re: Optimizing a huge_table/tiny_table join In-reply-to: <200605250052.k4P0qrT11965@panix3.panix.com> References: <200605250052.k4P0qrT11965@panix3.panix.com> Comments: In-reply-to message dated "Wed, 24 May 2006 20:52:53 -0400" Date: Wed, 24 May 2006 21:41:59 -0400 Message-ID: <7082.1148521319@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/461 X-Sequence-Number: 19248 writes: > Limit (cost=19676.75..21327.99 rows=6000 width=84) > -> Hash Join (cost=19676.75..1062244.81 rows=3788315 width=84) > Hash Cond: (upper(("outer".id)::text) = upper(("inner".id)::text)) > -> Seq Scan on huge_table h (cost=0.00..51292.43 rows=2525543 width=46) > -> Hash (cost=19676.00..19676.00 rows=300 width=38) > -> Seq Scan on tiny_table t (cost=0.00..19676.00 rows=300 width=38) Um, if huge_table is so much bigger than tiny_table, why are the cost estimates for seqscanning them only about 2.5x different? There's something wacko about your statistics, methinks. regards, tom lane