Re: Index Scans become Seq Scans after VACUUM ANALYSE

From: tycho(at)fruru(dot)com
To: Maarten(dot)Boekhold(at)reuters(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Index Scans become Seq Scans after VACUUM ANALYSE
Date: 2002-04-18 08:41:15
Message-ID: Pine.LNX.4.44.0204181038260.9447-100000@perycles.unix.be.EU.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 18 Apr 2002 Maarten(dot)Boekhold(at)reuters(dot)com wrote:

>
> On 04/17/2002 01:44:46 PM Michael Loftis wrote:
> > In many of the cases where it is a primary key it is also there to
> > ensure fast lookups when referenced as a foreign key.  Or for joins.
>
> Don't know if the optimizer takes this into consideration, but a query that uses a primary and/or unique key in the where-clause, should always choose to use
> the related indices (assuming the table size is above a certain threshold). Since a primary key/unique index always restricts the resultset to a single row.....

I don't think so.

eg. table with primary key "pk", taking values from 1 to 1000000 (so
1000000 records)

select * from table where pk > 5

should probably not use the index ...

Cheers
Tycho

--
Tycho Fruru tycho(dot)fruru(at)conostix(dot)com
"Prediction is extremely difficult. Especially about the future."
- Niels Bohr

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Karel Zak 2002-04-18 08:55:19 Re: updated qCache
Previous Message Karel Zak 2002-04-18 08:34:08 Re: updated qCache