Re: index use again and again - Mailing list pgsql-general

From Holger Marzen
Subject Re: index use again and again
Date
Msg-id Pine.LNX.4.44.0202121602470.16992-100000@bluebell.marzen.de
Whole thread Raw
In response to Re: index use again and again  ("Roderick A. Anderson" <raanders@tincan.org>)
List pgsql-general
On Tue, 12 Feb 2002, Roderick A. Anderson wrote:

> On Tue, 12 Feb 2002, Holger Marzen wrote:
>
> > I read the Postgres boog, browsed the mailing list archives and have
> > still no clue.
> >
> > I have a table with about 150.000 rows and put some indexes (not unique)
> > on it. If I use "=" in the where clause tha index is used, if I use ">"
> > or "between" then it is not used. It happens both with 7.1.3 and the new
> > 7.2:
>
> Previous discussion on this topic give me the idea that index use is
> determined by the optimizer and it will use and index or sequential
> depending on some percentage of the records it thinks will be returned.
>    I.e. is it more economical to just go through them all or spend time
> jumping around getting the right records.  Of course one of the hackers
> will be able to give you a much better and probably correct explanation.

Yes. When I choose a ">" that returns only a few rows then EXPLAIN
reports an index scan. So it's depending on the number of returned rows.

--
PGP/GPG Key-ID:
http://blackhole.pca.dfn.de:11371/pks/lookup?op=get&search=0xB5A1AFE1


pgsql-general by date:

Previous
From: Fernando San Martín Woerner
Date:
Subject: too much postgres client open
Next
From: Denis Perchine
Date:
Subject: Re: Index on timestamp field, and now()