Re: INDEX PROBLEMS ?

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: PostgreSQL Server <postgres(at)rsd(dot)it>, pgsql-sql(at)postgresql(dot)org
Subject: Re: INDEX PROBLEMS ?
Date: 2002-11-16 19:06:20
Message-ID: web-1829092@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2002-11-16 19:09:41 Re: Proposal of hierarchical queries, a la Oracle
Previous Message Tom Lane 2002-11-16 18:42:08 Re: DATE TIME INDEX ?