Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B5A51475EB4 for ; Sat, 16 Nov 2002 14:02:33 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 159A4475E24 for ; Sat, 16 Nov 2002 14:02:33 -0500 (EST) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.5.9) with HTTP id 1829092; Sat, 16 Nov 2002 11:06:20 -0800 From: "Josh Berkus" Subject: Re: INDEX PROBLEMS ? To: PostgreSQL Server , pgsql-sql@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.5.9 Date: Sat, 16 Nov 2002 11:06:20 -0800 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/241 X-Sequence-Number: 10383 Alex, > On postgres 7.2.3 I have found what follows: > > explain select * from documents where iddoc>1; > > Seq Scan on lotti (cost=0.00..831.79 rows=26783 width=98) > > EXPLAIN > explain select * from documents where iddoc=1; > > Index Scan using lotti_pkey on lotti (cost=0.00..2.26 rows=1 > width=98) > > Why index is not used for operators > and < ???? Because ">" is returning 26,000 rows. When you return that many rows, a Seq Scan is faster. -Josh