Re: Index usage vs large repetitions of key - Mailing list pgsql-general

From Neil Conway
Subject Re: Index usage vs large repetitions of key
Date
Msg-id 20020507132946.52fe57e9.nconway@klamath.dyndns.org
Whole thread Raw
In response to Re: Index usage vs large repetitions of key  (Francisco Reyes <lists@natserv.com>)
Responses Re: Index usage vs large repetitions of key
List pgsql-general
On Tue, 7 May 2002 09:48:13 -0400 (EDT)
"Francisco Reyes" <lists@natserv.com> wrote:
> On Sun, 5 May 2002 felix@crowfix.com wrote:
> > I think there is some way to force an indexed read, but I have
> > forgotten what little I knew about that.  If there is, you could try
> > both ways and compare timings.
>
> Based on this info it may make sense to let it do the sequential scan.

You can easily test this hypothesis by disabling sequential scans (SET
enable_seqscan = off;), and using EXPLAIN ANALYZE to compare the performance
of the resulting query plan with the one chosen by the planner to
begin with.

> In the coming months the table in question is going to grow 3 to 4 times
> it's number of records so at that point the index may make more sense.
>
> Is there a drawback on having the index right now?

Yes; inserts and updates will need to update the index. Depending on
your queries, this can be a significant performance hit.

> I guess it would make the optimizer's work more even though it would
> likely not choose the index anyway.

My guess would be that this wouldn't be a very significant factor.

Cheers,

Neil

--
Neil Conway <neilconway@rogers.com>
PGP Key ID: DB3C29FC

pgsql-general by date:

Previous
From: Ron Snyder
Date:
Subject: Re: Using views and MS access via odbc
Next
From: Andrey Mosienko
Date:
Subject: Reference to NEW, OLD values in TRIGGER