Received: from swan.prod.itd.earthlink.net (swan.mail.pas.earthlink.net [207.217.120.123]) by postgresql.org (Postfix) with ESMTP id 550C3476555 for ; Fri, 5 Apr 2002 12:02:48 -0500 (EST) Received: from 1cust8.tnt2.richmond.in.da.uu.net ([63.26.248.8] helo=nick) by swan.prod.itd.earthlink.net with smtp (Exim 3.33 #1) id 16tX6x-0004Wf-00; Fri, 05 Apr 2002 09:02:52 -0800 Reply-To: From: "Nick Fankhauser" To: "Tom Lane" Cc: "pgsql-admin" Subject: Re: A plan returned by explain doesn't make sense to me Date: Fri, 5 Apr 2002 12:01:42 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <24798.1018025136@sss.pgh.pa.us> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Importance: Normal X-Archive-Number: 200204/64 X-Sequence-Number: 3953 Tom Lane wrote: > The only reason the planner should choose a single-column index over > using the first column of a multi-column index is that the latter index > is likely to be physically larger and thus require more I/O to access. > So, there's no penalty in the cost calculations other than the > number-of-blocks-of-I/O estimated from the physical index size. So is a multi-column index really just two separate indexes with a constraint added if necessary? I guess I had an idea in my head that it would be something like an index on the concatenation of the two fields. > It > would be interesting to see the reltuples and relpages stats from > pg_class for your single- and multi-column indexes. It's easy to reverse the process. How would I get those stats? > It's actually a standard recommendation that you not bother with an > index on a single column x if you also have one on (x,y). Thanks- that will make my app a bit more efficient. (But now I've got to go back & work on tuning my query again because this apparently wasn't the source of the poor performance.) -Nick