pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: PostgreSQL Server <postgres@rsd.it>
To: pgsql-sql@postgresql.org
Subject: Re: INDEX PROBLEMS ?
Date: Sat, 16 Nov 2002 11:06:20 -0800
Message-ID: <web-1829092@davinci.ethosmedia.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0211161901570.8254-100000@sunrise2.radiostudiodelta.it>

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





view thread (2+ messages)

Message-ID: <web-1829092@davinci.ethosmedia.com>
Permalink:  ../web-1829092@davinci.ethosmedia.com/
Also on:    postgresql.org/message-id/web-1829092@davinci.ethosmedia.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, postgres@rsd.it
  Subject: Re: INDEX PROBLEMS ?
  In-Reply-To: <web-1829092@davinci.ethosmedia.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox