Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 57702476427 for ; Wed, 15 May 2002 11:27:20 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 6B4B847618B for ; Wed, 15 May 2002 11:19:43 -0400 (EDT) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.5.9) with HTTP id 1460613; Wed, 15 May 2002 08:19:46 -0700 From: "Josh Berkus" Subject: Re: Help on indexes To: Stephane DEWITTE , X-Mailer: CommuniGate Pro Web Mailer v.3.5.9 Date: Wed, 15 May 2002 08:19:46 -0700 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Archive-Number: 200205/159 X-Sequence-Number: 7795 Stephane, > I don't understanf why it makes a seq scan on table mldecs on cases 2 > and 3, > according that mldecs(ldec_dec_cod) has an index (named > ldec_dec_cod_mldecs_key). The base is vacuumed and analyzed every > night. How > can I use the ldec_dec_cod_mldecs_key index on mldecs ? First question: Have you actually measured the execution time of the various queries? There are many cases where a Seq Scan is faster than an Index Scan. For example, if in Case2, 50% of the entries were values 'X' of 'Y', then a Seq Scan is the better approach. Please determine that you actually have a problem with slow execution. Otherwise, the query parser is just doing its job. -Josh Berkus