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