Re: help with query... - Mailing list pgsql-general

From Tom Lane
Subject Re: help with query...
Date
Msg-id 10955.1180389188@sss.pgh.pa.us
Whole thread Raw
In response to help with query...  (marcelo Cortez <jmdc_marcelo@yahoo.com.ar>)
List pgsql-general
marcelo Cortez <jmdc_marcelo@yahoo.com.ar> writes:
> I am confused  ,
> way planer it does not use the partial index?
> query:

>   SELECT cliente_base.* FROM cliente_base
>  WHERE (cliente_base.inst_class_ = 'Cliente' ) ORDER
> BY cliente_base.nombre ASC

Because it thinks the seqscan is cheaper.  It might be right, depending
on how selective the index predicate is and how close the index order
matches the physical heap order.  Have you tried forcing an indexscan
(eg, by setting enable_sort = off) and comparing estimated and actual
costs for that case?

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: How to implement GOMONTH function
Next
From: Tom Lane
Date:
Subject: Re: Possible DB corruption