Re: Indices (was Re: [GENERAL] query seems too slow)

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Holger Klawitter <holger(at)klawitter(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Indices (was Re: [GENERAL] query seems too slow)
Date: 1999-11-06 14:22:11
Message-ID: Pine.LNX.4.20.9911061512490.347-100000@peter-e.yi.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 1999-11-04, Holger Klawitter mentioned:

>
> By the way,
>
> I've created a secondary index on a large table in order to
> gain some speed (the index is not unique), but the "explain"
> did not report any change.
>
> What else do I have to do to actually *use* an index? The manual
> only tells how to create one.

In general, nothing.

But:
* Perhaps your table is not big enough so the optimizer doesn't deem the
index worth its while.

* Perhaps you haven't run vacuum analyze lately, so the optimizer doesn't
even know the table size and makes questionable decisions.

* Perhaps your query is formed in a way that disqualifies the use of
indices.

* Perhaps the way you formed your query confuses the parser/optimizer.
(There are several such "unfortunate circumstances"/bugs.)

* Finally: Perhaps the optimizer is really smarter than you.

> FAQ?

Definitely. Question 4.9.

-Peter

--
Peter Eisentraut Sernanders vaeg 10:115
peter_e(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 1999-11-06 14:36:43 Re: [GENERAL] Help with query (fwd)
Previous Message José A. Navarro =?iso-8859-1?Q?Ram=F3n?= 1999-11-06 02:04:17 subscribe pgsql-general