Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 1A5349FB291 for ; Sat, 5 May 2007 19:00:59 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 15049-10 for ; Sat, 5 May 2007 19:00:51 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.243]) by postgresql.org (Postfix) with ESMTP id 07B9C9FB272 for ; Sat, 5 May 2007 19:00:54 -0300 (ADT) Received: by an-out-0708.google.com with SMTP id d17so31017and for ; Sat, 05 May 2007 15:00:54 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=a0tC81MEcDWWT4Cc9g3Yh+aHc7qKeto9jRpXo27Ess/ZhGHY+NDYtzQfKfz86bAf4BelQts2N60oOvSJ9wqp2HSzLtn5fTCvWS3nU3bcCxcFImPP1bKoiBmF/dqeTNl6kl0uessleR9xgiUdhv3gBJ2Jjtgs2gWmbyjrGn268Ok= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=iCWdh90AQ56CmK4V+hJg1fhalFhFeEPHKOm8WbpIM0qVa488h0JQ5KI5qr9NMCOFWo7dwcqJtBuepud1WRF1kRlQHGIqlQ6hRSs3JVJ6eTF0iPMQM1rcrFD63ATRt4D+WTiVfzeEFFsPh9/LqR8eF7p5bo26H0rQOP6pTbmXBWA= Received: by 10.100.57.14 with SMTP id f14mr3735947ana.1178402453948; Sat, 05 May 2007 15:00:53 -0700 (PDT) Received: by 10.100.144.18 with HTTP; Sat, 5 May 2007 15:00:53 -0700 (PDT) Message-ID: Date: Sat, 5 May 2007 17:00:53 -0500 From: "Aaron Bono" To: "Andrew Sullivan" Subject: Re: Sequence vs. Index Scan Cc: pgsql-sql@postgresql.org In-Reply-To: <20070505213009.GA22573@phlogiston.dyndns.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_70475_872006.1178402453890" References: <20070505213009.GA22573@phlogiston.dyndns.org> X-Google-Sender-Auth: a967e1e00f45560a X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/27 X-Sequence-Number: 28308 ------=_Part_70475_872006.1178402453890 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 5/5/07, Andrew Sullivan wrote: > > On Sat, May 05, 2007 at 04:05:52PM -0500, Aaron Bono wrote: > > I have two schemas, both with the exact same DDL. One performs great > and > > Do they have the same data? They have different data. The fast one has about 150 rows and the slow one has about 40 rows. The field in question here, the branch_id, is a BIGSERIAL in both. > I have > > checked and there IS an index, specifically a primary key index, on the > > branch_id in both schemas so I cannot figure out why the optimizer is > > looking at these differently. In fact, the table the branch_id comes > from > > has the exact same indices and foreign keys on both schemas. > > Different data? Different statistics? Different numbers of > (possibly dead) rows? We don't allow deletes and updates are fairly infrequent. I also did a vacuum analyze to no effect. What can I do to get more statistics that would help? Thanks for the help, Aaron -- ================================================================== Aaron Bono Aranya Software Technologies, Inc. http://www.aranya.com http://codeelixir.com ================================================================== ------=_Part_70475_872006.1178402453890 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 5/5/07, Andrew Sullivan <ajs@crankycanuck.ca> wrote:
On Sat, May 05, 2007 at 04:05:52PM -0500, Aaron Bono wrote:
> I have two schemas, both with the exact same DDL.  One performs great and

Do they have the same data?

They have different data.  The fast one has about 150 rows and the  slow one has about 40 rows.  The field in question here, the branch_id, is a BIGSERIAL in both.

>  I have
> checked and there IS an index, specifically a primary key index, on the
> branch_id in both schemas so I cannot figure out why the optimizer is
> looking at these differently.  In fact, the table the branch_id comes from
> has the exact same indices and foreign keys on both schemas.

Different data?  Different statistics?  Different numbers of
(possibly dead) rows?


We don't allow deletes and updates are fairly infrequent.  I also did a vacuum analyze to no effect.

What can I do to get more statistics that would help?

Thanks for the help,
Aaron

--
==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
   http://codeelixir.com
================================================================== ------=_Part_70475_872006.1178402453890--