Re: only one index is using, why? - Mailing list pgsql-performance

From Marti Raudsepp
Subject Re: only one index is using, why?
Date
Msg-id AANLkTikAWrH36myhdgYghVrtVf1h92iOp6hcd2rDZL+h@mail.gmail.com
Whole thread Raw
In response to only one index is using, why?  (AI Rumman <rummandba@gmail.com>)
List pgsql-performance
On Wed, Dec 15, 2010 at 08:56, AI Rumman <rummandba@gmail.com> wrote:
> My question is why "crmentity_setype_idx" index is being used only.
> "crmentity_deleted_idx" index is not using.
> Any idea please.

Because the planner determined that the cost of scanning *two* indexes
and combining the results is more expensive than scanning one index
and filtering the results afterwards.

Looks like your query could use a composite index on both columns:
(deleted, setype)
Or a partial index:  (setype) WHERE deleted=0

Regards,
Marti

pgsql-performance by date:

Previous
From: AI Rumman
Date:
Subject: only one index is using, why?
Next
From: Rauan Maemirov
Date:
Subject: Problems with FTS