Re: Index usage vs large repetitions of key

From: Neil Conway <nconway(at)klamath(dot)dyndns(dot)org>
To: "Francisco Reyes" <lists(at)natserv(dot)com>
Cc: felix(at)crowfix(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: Index usage vs large repetitions of key
Date: 2002-05-07 17:29:46
Message-ID: 20020507132946.52fe57e9.nconway@klamath.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 7 May 2002 09:48:13 -0400 (EDT)
"Francisco Reyes" <lists(at)natserv(dot)com> wrote:
> On Sun, 5 May 2002 felix(at)crowfix(dot)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(at)rogers(dot)com>
PGP Key ID: DB3C29FC

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrey Mosienko 2002-05-07 18:20:52 Reference to NEW, OLD values in TRIGGER
Previous Message Ron Snyder 2002-05-07 16:21:49 Re: Using views and MS access via odbc