Re: Ok, why isn't it using *this* index?

From: "ADBAAMD" <adba(dot)amdocs(at)bell(dot)ca>
To: "Denis A(dot) Doroshenko" <d(dot)doroshenko(at)omnitel(dot)net>
Cc: "Paul Tomblin" <ptomblin(at)xcski(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Ok, why isn't it using *this* index?
Date: 2001-04-01 22:19:26
Message-ID: 3AC7A96E.6020301@bell.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Denis A. Doroshenko wrote:

> On Sun, Apr 01, 2001 at 05:11:46PM -0400, Paul Tomblin wrote:
>
>> Ok, so if I understand you correctly, the fact that about 90% of the
>> records have country='USA' and about 9% of the records have
>> country='CANADA' means that it's never going to use the index because it
>> on average, a query is going to be for USA, and a sequential scan is going
>> to be better.
>>
>> I think I understand now. If this is correct, then doesn't it make sense
>> just to drop that index? At least until I get a lot more data from other
>> countries?
>
>
> huh, this seems to be ineteresting to know, just because this
> "feature" may seriously affect effectivity. by the way, have you tried
> to disable sequential scan? that may force pgsql to use an index in
> any case, AFAIK.

It is not always a good idea to force the use of the index. Overriding
the planner should only be done after tests on realistic volumes of data
and with a thorough understanding about what's going on.

In fact it is wise to work only with the indices you will use frequently
and tables that have some significant queries as compared to updates,
because updates get *slower* with indices!

--
_
/ \ Leandro Guimarães Faria Corsetti Dutra +55 (11) 3040 8913
\ / Amdocs at Bell Canada +1 (514) 786 87 47
X Support Center, São Paulo, Brazil mailto:adbaamd(at)bell(dot)ca
/ \ http://terravista.pt./Enseada/1989/ mailto:leandrod(at)amdocs(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-04-01 22:42:04 Re: another index question
Previous Message Paul Tomblin 2001-04-01 22:16:04 Re: How do I...