X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C8DD19DCC7C for ; Sat, 17 Dec 2005 10:56:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06316-02 for ; Sat, 17 Dec 2005 10:56:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc11.comcast.net (rwcrmhc11.comcast.net [216.148.227.151]) by postgresql.org (Postfix) with ESMTP id 776479DCBE7 for ; Sat, 17 Dec 2005 10:56:46 -0400 (AST) Received: from candle.pha.pa.us ([71.225.87.206]) by comcast.net (rwcrmhc11) with ESMTP id <2005121714565001300c8cdde>; Sat, 17 Dec 2005 14:56:50 +0000 Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id jBHEunM07437; Sat, 17 Dec 2005 09:56:49 -0500 (EST) From: Bruce Momjian Message-Id: <200512171456.jBHEunM07437@candle.pha.pa.us> Subject: Re: Simple Join In-Reply-To: <7484.1134600423@sss.pgh.pa.us> To: Tom Lane Date: Sat, 17 Dec 2005 09:56:49 -0500 (EST) CC: Kevin Brown , pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.157 required=5 tests=[AWL=0.157] X-Spam-Score: 0.157 X-Spam-Level: X-Archive-Number: 200512/425 X-Sequence-Number: 16246 Tom Lane wrote: > Kevin Brown writes: > > I'm running 8.1 installed from source on a Debian Sarge server. I have a > > simple query that I believe I've placed the indexes correctly for, and I > > still end up with a seq scan. It makes sense, kinda, but it should be able > > to use the index to gather the right values. > > I continue to marvel at how many people think that if it's not using an > index it must ipso facto be a bad plan ... > > That plan looks perfectly fine to me. You could try forcing some other > choices by fooling with the planner enable switches (eg set > enable_seqscan = off) but I doubt you'll find much improvement. There > are too many rows being pulled from ordered_products to make an index > nestloop a good idea. We do have an FAQ item: 4.6) Why are my queries slow? Why don't they use my indexes? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073