Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id DF009650E9E for ; Mon, 30 Jun 2008 21:39:06 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 74457-01 for ; Mon, 30 Jun 2008 21:38:33 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.28]) by postgresql.org (Postfix) with ESMTP id 86866650E81 for ; Mon, 30 Jun 2008 21:38:18 -0300 (ADT) Received: by yw-out-2324.google.com with SMTP id 3so852509ywj.73 for ; Mon, 30 Jun 2008 17:38:00 -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 :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=nNGln+A+81a+NRumHzQEBR5Gf5v8HfsZPHqtC/lfLCE=; b=i7UjLK/E9QBUO3+bIziBm6wSGE8IhwOYs9oAO4T+MR7vTV1eAB4Eat6QaoQGzFVkCz xo8nbTt6yTIzDqy16tRa4DN83xU+62TNnxCL1+yAXIAKofFtPDewKV8t31Lp1jFNHoem 7y3v8i7JRgjQAMQt8vTVDKMJOvn2B5UF6a4Nc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=EP6sIU0GvTCrOG8f383zSMc5kDjdAqHfrJ6DqdsXsYU0vhfusZDipd1IUrrCAbKhPL Pbuq4N7eBPLWwh/+JGrHpc9f+1pgA5QxhM6gRqeOvN91/IqCZr88zGila4KuoI6t+oxN HC3ncjXg4dPFyvIYIpVxDU6TrKE19F+0jk7TA= Received: by 10.150.197.8 with SMTP id u8mr9444594ybf.122.1214872679946; Mon, 30 Jun 2008 17:37:59 -0700 (PDT) Received: from john-beavers-macbook-pro-2.local ( [24.218.26.7]) by mx.google.com with ESMTPS id 7sm7473554ywo.7.2008.06.30.17.37.58 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 30 Jun 2008 17:37:59 -0700 (PDT) Message-ID: <48697C66.5040501@gmail.com> Date: Mon, 30 Jun 2008 20:37:58 -0400 From: John Beaver User-Agent: Thunderbird 2.0.0.14 (Macintosh/20080421) MIME-Version: 1.0 To: Tom Lane CC: Jeremy Harris , Pgsql-Performance Subject: Re: sequence scan problem References: <48680418.7030708@gmail.com> <48680860.2000300@wizmail.org> <4868BC74.6020006@gmail.com> <28999.1214839555@sss.pgh.pa.us> In-Reply-To: <28999.1214839555@sss.pgh.pa.us> Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.994 tagged_above=0 required=5 tests=AWL=-0.679, HTML_MESSAGE=0.001, MIME_HTML_ONLY=1.672 X-Spam-Level: X-Archive-Number: 200806/250 X-Sequence-Number: 30600 <chuckle> You're right - for some reason I was looking at the (18 rows) at the bottom. Pilot error indeed - I'll have to figure out what's going on with my data.

Thanks!

Tom Lane wrote:
John Beaver <john.e.beaver@gmail.com> writes:
  
Ok, here's the explain analyze result. Again, this is Postgres 8.3.3 and 
I vacuumed-analyzed both tables directly after they were created.
    

  
 Merge Join  (cost=1399203593.41..6702491234.74 rows=352770803726 
width=22) (actual time=6370194.467..22991303.434 rows=15610535128 loops=1)
    
                                                        ^^^^^^^^^^^

Weren't you saying that only 50 rows should be returned?  I'm thinking
the real problem here is pilot error: you missed out a needed join
condition or something.  SQL will happily execute underconstrained
queries ...

			regards, tom lane