Re: index use again and again

From: Holger Marzen <holger(at)marzen(dot)de>
To: "Roderick A(dot) Anderson" <raanders(at)tincan(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: index use again and again
Date: 2002-02-12 15:04:01
Message-ID: Pine.LNX.4.44.0202121602470.16992-100000@bluebell.marzen.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Denis Perchine 2002-02-12 15:13:11 Re: Index on timestamp field, and now()
Previous Message Tom Lane 2002-02-12 14:57:56 Re: [HACKERS] Feature enhancement request : use of libgda in